// determine average grade for test
double GradeBook::getAverageGrade()
{
int total = 0; // initialize total
// sum grades in array
for ( int grade = 0; grade < STUDENTS; grade++ )
total += grades[ grade ];
// return average of grades
returnstatic_cast< double >( total ) / STUDENTS;
} // end function getAverage
// find maximum grade
int GradeBook::getMaximum()
{
int highGrade = 0; // assume highest grade is 0
// loop through grades array
for ( int grade = 0; grade < STUDENTS; grade++ )
{
// if current grade higher than highGrade, assign it to highGrade
if ( grades[ grade ] > highGrade )
highGrade = grades[ grade ]; // new highest grade
} // end for
return highGrade; // return highest grade
}
GradeBook.cpp: In member function ‘double GradeBook::getAverageGrade()’:
GradeBook.cpp:205: error: invalid conversion from ‘int*’ to ‘int’
GradeBook.cpp: In member function ‘int GradeBook::getMaximum()’:
GradeBook.cpp:220: error: ISO C++ forbids comparison between pointer and integer
GradeBook.cpp:221: error: invalid conversion from ‘int*’ to ‘int’