1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
//mid/final.cpp – displays the highest score earned on a midterm exam and the
//highest score earned on a final exam
#include <iostream>
using std::cout;
using std::endl;
int main()
{
//declare array - the first column contains the midterm scores, the second
//column contains the final scores
int scores[10][2] = {{78, 90}, {87, 88}, {65, 70}, {56, 100}, {74, 72},
{33, 47}, {87, 88}, {73, 73}, {79, 83}, {95, 89}};
//declare variables
int midTerm = scores[0][0]
int finalScore = score[0][0]
int high = 0;
//search for the highest value
for (x = 0; x < 4; x = x + 1)
for (y = 0;y < 5; y = y + 1)
if (scores[x][y] > high)
high = scores[x][y];
//end if
//end while
//display lowest value
cout << "Highest value: " << high << endl;
return 0;
} //end of main function
|