Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Ex: If the input

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles.
Ex: If the input is:
-
1
0
2
0
3
0
4
0
the output is:
Min miles:
-
1
0
Max miles:
4
0
IN C
+
+
please use this code and fill in
!
#include
using namespace std;
int main
(
)
{
const int NUM
_
ROWS
=
2
;
const int NUM
_
COLS
=
2
;
int milesTracker
[
NUM
_
ROWS
]
[
NUM
_
COLS
]
;
int i;
int j;
int maxMiles
=
0
;
/
/
Assign with first element in milesTracker before loop
int minMiles
=
0
;
/
/
Assign with first element in milesTracker before loop
int value;
for
(
i
=
0
; i
<
NUM
_
ROWS; i
+
+
)
{
for
(
j
=
0
; j
<
NUM
_
COLS; j
+
+
)
{
cin
>
>
value;
milesTracker
[
i
]
[
j
]
=
value;
}
}
cout
<
<
"Min miles:
"
<
<
minMiles
<
<
endl;
cout
<
<
"Max miles:
"
<
<
maxMiles
<
<
endl;
return
0
;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

3. Can basic and secondary functions be separated?

Answered: 1 week ago