I have completed most of the program I just cant get the letter grade to print from the void printGrade function.The output of the program should be:
Line 1: Based on the course score, this program computes the course grade.
Line 4: Enter course score:_
Line 6: Course score is:_
Line 7: Your grade for ths course is_
here is the program:
#include <iostream>
using namespace std;
int getScore(int& score);
void printGrade(int cScore);
int main()
{
int cScore;
int score;
cout << "Line 1: Based on the course score, \n"
<< " this program computes the "
<< "course grade." <<endl;
cScore = getScore(score) ;
printGrade(cSco re);
}
int getScore(int& score)
{
cout << "Line 4: Enter course score: ";
cin >> score;
cout << endl << "Line 6: Course score is "
<< score << endl;
system("PAUSE") ;
return score;
}
void printGrade(int cScore)
{
cout << "Line 7: Your grade for the course is ";
if (cScore >=90)
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;
}
thanks for the help in advance
Line 1: Based on the course score, this program computes the course grade.
Line 4: Enter course score:_
Line 6: Course score is:_
Line 7: Your grade for ths course is_
here is the program:
#include <iostream>
using namespace std;
int getScore(int& score);
void printGrade(int cScore);
int main()
{
int cScore;
int score;
cout << "Line 1: Based on the course score, \n"
<< " this program computes the "
<< "course grade." <<endl;
cScore = getScore(score) ;
printGrade(cSco re);
}
int getScore(int& score)
{
cout << "Line 4: Enter course score: ";
cin >> score;
cout << endl << "Line 6: Course score is "
<< score << endl;
system("PAUSE") ;
return score;
}
void printGrade(int cScore)
{
cout << "Line 7: Your grade for the course is ";
if (cScore >=90)
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;
}
thanks for the help in advance
Comment