This won't compile... :(
#include
using namespace std;
void getScore(int& score);
char convertScoreToGrade(int cScore);
int main()
{
int courseScore;
cout << "Line 1: Based on the course score, this "
<< "program computes the course grade.";
getScore(courseScore);
convertScoreToGrade(int cScore);
cout << "Line 7: Your grade for the course is ";
return 0;
}
void getScore(int& score)
{
cout << "Line 4: Enter the course score: ";
cin >> score;
cout << endl << "Line 6: Course score is "
<< score << endl;
}
char convertScoreToGrade(int cScore)
{ if (cScore >= 90)
return 'A';
else if (cScore >= 80)
return 'B';
else if (cScore >= 70)
return 'C';
else if (cScore >= 60)
return 'D';
else
return 'F';
}
Why doesn't it compile? What's the compiler saying?
Two reasons it won't work:
1. You don't keep the return of convertScoreToGrade() to a char variable.
2. You don't print out the returned value of convertScoreToGrade()
yeah, the most important thing when asking for help is to post the compiler errors.