// grade.cpp // display the letter grade corresponding to an exam // score assuming a noormal scale
# include ; using namespace std;
void displayGrade (int score);
int main () { int score; displayGrade(); cin.get(); return 0 ; } // get the data void displayGrade cout << " ENTER THE GRADE : " << score << endl; cin >> score; { if ( score >= 90 ) cout << "grade is A" << endl; else if ( score >=80 ) cout << "grade is B " << endl; else if ( score >= 70 ) cout << " grade is C " << endl; else if ( score >= 60 ) cout << " grade is D " << endl; else cout << "grade is F " << endl; } return displayGrade;
I am still confused with the function and variable and the way we declare and organize it/.
Hi ,
Your question is not clear to me.. what exactly you want to know.
The code written above will give compilation error as it will not identify any function displayGrade() as the function you have declared before main is displayGrade(int).
Hence before calling any function make sure that the function is atleast declared.
There are also a few syntax errors. But please be specific what exactly you want.