Design and run a program that takes a numerical score and outputs a letter grade. Specific numerical scores and letter grades are listed below:
90-100 = Grade A
80-89 = Grade B
70-79 = Grade C
60-69 = Grade D
0-59 = Grade F
In this program, create two void functions titled getScore and printGrade with an int argument. The function getScore should have a Reference parameter and printGrade should have a Value parameter.
The function getScore will prompt the user for the numerical score, get the input from the user, and print the numerical score. The function printGrade will calculate the course grade and print the course grade. (Be careful and note that the assignment requires you to input the grade into getScore and not directly into the main function.)
Do not forget to put in the proper prompts and appropriate output messages. (Note: This program is a natural for use of the switch command, but if?else structures will also work.)
This is what I have so far
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int count;
int score;
int getScore();
void printGrade( int score );
int main()
{
for ( count = 1; count <= 10; count++ )
{
getScore();
printGrade( int score );
}
system( "pause");
return 0;
}
int getscore( int )
{
cout << " Enter a number score ";
cin >> score;
cout << score;
return score;
}
void printGrade( int score )
{
if ( score >= 90 )
cout << "A";
else if ( score >= 80 )
cout << "B";
else if ( score >= 70 )
cout << "C";
else if ( score >= 60 )
cout << "D";
else
cout << "F";
}
I keep getting the error message Line 21 C:\Dev-Cpp\WA 2 part 2.cpp expected primary-expression before "int"
Can someone please tell me what that means or what I need to do to fix it and make this program work?