44 // calculate average
grade for each student
45 for ( int person = 0; person < students;
person++ )
46 cout
<< "The
average grade for student " << person
47 << " is "
48 << average( studentGrades[
person ], exams )
49 << endl;
50
51 return 0; // indicates successful termination
52
53 } // end main
54
55 // find minimum grade
56 int minimum( int grades[][ exams ], int pupils, int tests )
57 {
58 int lowGrade = 100; // initialize to
highest possible grade
59
60 for ( int i = 0; i < pupils; i++ )
61
62 for ( int j = 0; j < tests; j++ )
63
64 if ( grades[ i ][ j ]
< lowGrade )
65 lowGrade = grades[ i ][ j ];
66
67 return lowGrade;
68
69 } // end function minimum
Determines the average for one student. We pass the array/row containing the student’s grades. Note that studentGrades[0] is itself an array.