Im writing a progam that calculate a person test score then prints out a letter grade bt i need to modify it so that the function "PrintGrade" actually keeps track of the highest score entered
this is what I have so far...
//This program reads a course score and prints the
//associated course grade.
#include <iostream>
#include <ctype.h>
using namespace std;
void getScore(int& );
void printGrade(int , int &);
int main ()
{
int courseScore, highest;
char choice;
cout << "Line 1: Based on the course score, \n"
<< " this program computes the "
<< "course grade." << endl; //Line 1
do {
getScore(courseScore); //Line 2
printGrade(courseScore, highest);
//Line 3
cout<<"Anymore scores(Y/N)?";
cin>>choice;
}while (toupper(choice) != 'N');
system("pause");
return 0;
}
void getScore(int& score)
{
cout << "Line 4: Enter course score: "; //Line 4
cin >> score; //Line 5
cout << endl << "Line 6: Course score is "
<< score << endl; //Line 6
}
void printGrade(int cScore, int & high)
{
cout << "Line 7: Your grade for the course is "; //Line 7
if (cScore >= 90) //Line 8
cout << "A." << endl;
else if (cScore >= 80)
cout << "B." << endl;
else if(cScore >= 70)
cout << "C." << endl;
else if (cScore >= 60)
cout << "D." << endl;
else
cout << "F." << endl;
cout<<"\nThe highest score thus far is: "<<high<<endl;
}