Programming In C:
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program:
Min miles: -10
Max miles: 40
#include
int main(void) {
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 */
printf("Min miles: %d\n", minMiles);
printf("Max miles: %d\n", maxMiles);
return 0;
}

Respuesta :

The following software is written in the C++ programming language.Set up two integer type variables and initialize them to 0, then set up two integer type variables and initialize them to -99.  

What is the maximum and minimum value in milesTracker?

Set the values in the two-dimensional array to zero.To find the least and maximum miles, set two for loop for the two-dimensional array.Set two if conditions to find longer or shorter distances.Finally, print the maximum and minimum miles before returning 0.

#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

milesTracker[NUM ROWS][NUM COLS] int;

//set integer type variable and initialize to 0

int i = 0;

//set integer type variable and initialize to 0

int j = 0;

/create an integer variable and initialize it 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  

miles = maximumMiles

minMiles = milesTracker[0][0]; Tracker[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] more than maxMiles)

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

//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;

Output:

Min miles: -10

Max miles: 40

To learn more about C++ Programming refer

https://brainly.com/question/14101280

#SPJ4

ACCESS MORE