1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ulleksa [173]
3 years ago
5

#include using namespace std; int main( ) { const int NUM_ROWS = 2; const int NUM_COLS = 2; int milesTracker[NUM_ROWS][NUM_COLS]

; int i = 0; int j = 0; int maxMiles = -99; // Assign with first element in milesTracker before loop int minMiles = -99; // Assign with first element in milesTracker before loop milesTracker[0][0] = -10; milesTracker[0][1] = 20; milesTracker[1][0] = 30; milesTracker[1][1] = 40;
Computers and Technology
1 answer:
VARVARA [1.3K]3 years ago
5 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   const int NUM_ROWS = 2;

   const int NUM_COLS = 2;

   int milesTracker[NUM_ROWS][NUM_COLS];

   int i = 0;

   int j = 0;

   int maxMiles = -99; // Assign with first element in milesTracker before loop

   int minMiles = -99; // Assign with first element in milesTracker before loop

   milesTracker[0][0] = -10;

   milesTracker[0][1] = 20;

   milesTracker[1][0] = 30;

   milesTracker[1][1] = 40;

   

   maxMiles = milesTracker[0][0];

   minMiles = milesTracker[0][0];

   

   for (i = 0; i < NUM_ROWS; i++){

       for (j = 0; j < NUM_COLS; j++){

           if (milesTracker[i][j] > maxMiles){

               maxMiles = milesTracker[i][j];

           }

           if (milesTracker[i][j] < minMiles){

               minMiles = milesTracker[i][j];

           }

       }

   }

   

   cout << "Min: " << minMiles << endl;

   cout << "Max: " << maxMiles << endl;

   return 0;

}

Explanation:

It seems you want to find the min and max value in the array. Let me go through what I added to your code.

Set the maxMiles and minMiles as the first element in milesTracker

Create a nested for loop that iterates through the milesTracker. Inside the loop, check if an element is greater than maxMiles, set it as maxMiles. If an element is smaller than minMiles, set it as minMiles.

When the loop is done, print the minMiles and maxMiles

You might be interested in
There is a natural tendency on the part of users and system managers to perceive little benefit from security investment until a
spayn [35]

Answer:

The answer is True

Explanation:

Users and system managers/administrators do not necessarily see the use of security investments, because there is no security breach or security failure to the system.

When security infrastructures are in place, it is to prevent or at least reduce the possibility of devaluation, modification, corruption, destruction or deletion, disruption, disclosure, use, and inappropriate or unauthorized access. So, if any of these breaches do not occur, system managers and users perceive little benefits from security investments.

6 0
3 years ago
For BitTorrent, which of the following is true:
Bumek [7]

Answer:

d. All of the above

Explanation:

All the above mentioned statements are true about BitTorrent.

8 0
3 years ago
What are some advantages and disadvantages of streaming and downloading?
stepladder [879]

Answer:

Pro Cons

It is possible to download legitimate music files that do not include DRM and so makes it easier for you to listen to your tracks on different devices. The file may include DRM protection that you were not expecting when you joined the service. Read the fine print.

Explanation:

7 0
3 years ago
A user of the system
iragen [17]

Answer:

ummm what system. have to be more specific ^^

Explanation:

8 0
3 years ago
The Smith family has five children who work in a variety of careers. They include a Building Designer, an Astrophysicist, a Comp
Viefleur [7K]

The correct answer is the Science, Technololy, Engineering and Math career cluster.

All of the five careers that are listed fall into the career cluster that is called Science, Technology, Engineering and Math. People working in this career cluster could work in science labs, design products and systems, or support scientists or mathematicians in their work.

7 0
3 years ago
Read 2 more answers
Other questions:
  • 6:57 47minutes before
    15·2 answers
  • Marty uses a customized database to sort parts and track inventory. The customized database is an example of _____.
    14·1 answer
  • You must _____ the recording of the macro when you have completed the tasks it was designed to do
    10·1 answer
  • What's true about freedom
    12·2 answers
  • The four smallest numbers (40 points) Write an ANNA assembly program (smallest_four.ac) that finds the four smallest numbers ent
    11·1 answer
  • Suppose that L is a sorted list of 1,000,000 elements. To determine whether the x item is in L, the average number of comparison
    14·1 answer
  • Custom Offers empower Sellers to upsell even higher than their Premium Packages—but when should a Custom Offer be used?
    12·1 answer
  • I really need help please help me
    6·1 answer
  • Please help!!!!!!! 50 POINTS!!!!
    10·1 answer
  • Html quickly evolved through specifications that are the result of the collective work of the organization known as the ____.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!