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
Choose the proper term to describe each of the following examples.
Lady_Fox [76]

Answer:first 1

Explanation:

4 0
3 years ago
Write a method called listUpper() that takes in a list of strings, and returns a list of the same length containing the same str
lord [1]

Answer:

public static List<String> listUpper(List<String> list){

    List<String> upperList = new ArrayList<String>();

   

    for(String s:list){

        s = s.toUpperCase();        

        upperList.add(s);

    }

    return upperList;

}

Explanation:

Create a method named listUpper that takes list as a parameter

Inside the method, initialize a new list named upperList. Create a for-each loop that iterates through the list. Inside the loop, convert each string to uppercase, using toUpperCase method, and add it to the upperList.

When the loop is done, return the upperList

6 0
3 years ago
Here’s the revenue and expenses for the month. Calculate whether Mia had a profit or loss?
Usimov [2.4K]

Answer:

ikr????

bruh.

Explanation:

3 0
3 years ago
A Windows user is locked out of her computer, and you must log into the local administrator account Helpdesk Admin. Which would
Damm [24]

Answer:

B is the correct answer

5 0
3 years ago
When a programmer exploits written code that doesn't check for a defined amount of memory space they are executing which of the
bazaltina [42]

Answer:

The correct answer to the following question will be "Buffer overflow".

Explanation:

  • For security policy and computing, the buffer overflow is a phenomenon where the code overwrites the boundaries of the buffer when adding data to the buffer and overwrites neighboring storage positions.
  • A vulnerability of buffer overflow occurs when you offer so much data to a program. Excessive data corrupts memory space in the vicinity and it may change certain data. As a consequence, the program could report a mistake or act differently. These vulnerabilities are often referred to as buffer overrun.
  • If the programmer constructs a compiled code which does not test for a given quantity of system memory, the buffer overflow would strike on it.

Therefore, Buffer overflow is the right answer.

4 0
3 years ago
Other questions:
  • Objective:This assignment is designed to give you experience with thinking about algorithm analysis and performanceevaluation.Pr
    11·1 answer
  • True or false. Every word has only one correct spelling and pronunciation.
    6·1 answer
  • Apache web server is the most widely used network operating system used on web servers.
    8·2 answers
  • What could be one possible reason where the recipient is not guaranteed that the data being streamed will not get interrupted?
    15·1 answer
  • A benefit of flashcards is that they are
    7·2 answers
  • Camille prepared excellent PowerPoint slides for her speech about education reform, but the speech didn't go as well as she had
    15·1 answer
  • Identify the benefit of modeling to communicate a solution. ​
    11·2 answers
  • In ipv4 addressing, each ip address is a unique ____ number.
    13·1 answer
  • Difference between Computer safety practices and precautions
    6·1 answer
  • 4.(L.5.1.A) Select the sentence that includes an interjection,
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!