Calling functions

Write a statement that calls computeMajorGpa and assigns the result to gpa. Note that this statement is part of the printMajorGpa() member function for Student, whose code is both above and below this code block.

void Student::printMajorGpa() const { // beginning of Student::printMajorGpa()
double gpa;

//The question goes here


cout << left << setw(20) << name;
if (gpa >= 0)
cout <<right << setw(5) << fixed << setprecision(1)
<< gpa << endl;
else
cout << "-----" << endl;
} // end of Student::printMajorGpa
Maybe something like this ...
 
double gpa = computeMajorGpa();
Topic archived. No new replies allowed.