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
MAVERICK [17]
3 years ago
10

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMile

s. Sample output for the given program:Min miles: -10Max miles: 40#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; /* Your solution goes here */ cout << "Min miles: " << minMiles << endl; cout << "Max miles: " << maxMiles << endl;}
Computers and Technology
1 answer:
ryzh [129]3 years ago
6 0

Answer:

Following are th program in the C++ Programming Language.

#include <iostream>//set Header files

using namespace std;//set namespace

//define main function

int main()

{

//set integer constants variable

const int NUM_ROWS = 2;

//set integer constants variable

const int NUM_COLS = 2;

//set integer type array

int milesTracker[NUM_ROWS][NUM_COLS];

//set integer type variable and initialize to 0

int i = 0;

//set integer type variable and initialize to 0

int j = 0;

//set integer type variable and initialize to -99

int maxMiles = -99;

//set integer type variable and initialize to -99

int minMiles = -99;

//initialize the value in the two dimensional array

milesTracker[0][0] = -10;

milesTracker[0][1] = 20;

milesTracker[1][0] = 30;

milesTracker[1][1] = 40;

//here is the solution  

maxMiles = milesTracker[0][0];

minMiles = milesTracker[0][0];

/*set for loop to find the minimum miles and maximum miles*/

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

{

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

 {

 //set if condition for maxMiles is the bigger than

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

   //initialize milesTracker[i][j] to maxMiles

     maxMiles = milesTracker[i][j];

   //set if condition for minMiles is the smaller than

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

   //initialize milesTracker[i][j] to maxMiles

     minMiles = milesTracker[i][j];

 }

}

//print output

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

//print output

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

return 0;

}

<u>Output:</u>

Min miles: -10

Max miles: 40

Explanation:

Here, we define the main method and inside it:

  • set two constant integer type variable and initialize to 2
  • set integer type two-dimensional array and pass constant variables in it.
  • Set two integer type variable and initialize to 0 then, again set two integer type variable and initialize to -99.
  • Initialize the values in the two-dimensional array.
  • Set two for loop for the two-dimensional array to find the minimum and maximum miles.
  • Set two if condition to find bigger or smaller miles.

Finally, print the maximum and the minimum miles then, return 0.

You might be interested in
Programming CRe-type the code and fix any errors. The code should convert non-positive numbers to 1.
LUCKY_DIMON [66]

Answer:

Given

The above lines of code

Required

Rearrange.

The code is re-arrange d as follows;.

#include<iostream>

int main()

{

int userNum;

scanf("%d", &userNum);

if (userNum > 0)

{

printf("Positive.\n");

}

else

{

printf("Non-positive, converting to 1.\n");

userNum = 1;

printf("Final: %d\n", userNum);

}

return 0;

}

When rearranging lines of codes. one has to be mindful of the programming language, the syntax of the language and control structures in the code;

One should take note of the variable declarations and usage

See attachment for .cpp file

Download cpp
5 0
3 years ago
If a piece of software designed to run on Windows XP can run on the latest version of Windows, we say the latest version of Wind
cluponka [151]

Answer:

Forward Compatible

Explanation:

If a piece of software designed to run on Windows XP can run on the latest version of Windows, we say the latest version of Windows is Forward Compatible.

Forward compatibility or upward compatibility is a design characteristic that allows a system to accept input intended for a later version of itself. The concept can be applied to entire systems, electrical interfaces, telecommunication signals, data communication protocols, file formats, and computer programming languages.

The objective for forward compatible technology is for old devices to recognise when data has been generated for new devices.

3 0
3 years ago
Word wrap is the same as __________ return and means you let the ______________ control when it will go to a new line.
dusya [7]

Word wrap is the same as; Soft Return

Word wrap means that you let the; Computer Control when it will go to a new line

<h3>What is Text Wrapping?</h3>

Text wrapping is simply defined as a process used in MS Word to Wrap a Text around an Image.

Now, the way it is done is by selecting the image you want to wrap text around and then On the Format tab, click the Wrap Text command in the Arrange group, then select the desired text wrapping option to wrap the text.

Finally Word wrap is also same as using soft return and letting the computer control when it goes to the next line.

Read more about text wrapping at; brainly.com/question/5625271

5 0
2 years ago
What is and effective way to display calculation in a word document?
Tju [1.3M]
You only put a numerical expression in  numbers if it is over 100, it the calculation correctly.
<span />
8 0
3 years ago
E-mail administrators may make use of _________________, which overwrites a log file when it reaches a specified size or at the
Karolina [17]
E-mail administrators may make use of Circular Logging which overwrites a log file when it reaches a specified size or at the end of a specified time frame.​Circular logging<span> is a method or feature used to conserve hard disk space by overwriting individual log files, thus keeping the transactional  log to a minimum.</span>
7 0
3 years ago
Other questions:
  • At an uncontrolled intersection, you should yield to the car on the right. True or false.
    10·2 answers
  • Place the steps in order to keep a graphic from spilling over into the next page and to include the text it is assciated with.
    12·1 answer
  • Websites whose URL’s contain tildes (~) are usually published by the government. TRUE or FALSE.
    8·2 answers
  • CottonPlus, a sportswear company, is releasing a new casual sportswear line. The company approaches a basketball star to endorse
    14·1 answer
  • The data-linking feature that allows Internet users to skip directly from a highlighted word to a related file in another comput
    12·2 answers
  • Which of the following is true of information systems?
    15·1 answer
  • A(n) _____ describes your core values and highest career goals. A. résumé B. objective statement C. qualifications profile D. pe
    7·2 answers
  • The _____ feature will mark all changes made to a document for others to review at a later time.
    13·1 answer
  • Site at least 3 articles of impact of internet that affect in our daily lives.
    15·1 answer
  • In cell K8, create a formula using the SUM function that calculates the total of range D17:D20 and subtracts it from the value i
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!