# include <iostream>
using namespace std;

void displayGrade (int ) ;
int main()
{
    const int SENTINEL = -1;
    int score;
    int sum;
    int count;
    int average;
    
    count = 0 ;
    sum = 0 ;
    cout << " Enter scores one at a time as requested . " << endl;
    cout << " When done, enter " << SENTINEL << " to stop. " << endl;
    cout << " Enter the first score : " ;
    cin >> score;
    while (score != SENTINEL )
    {
          sum += score;
          count++;
          displayGrade(score);
          cout << endl << "Enter the next score : " ;
          cin >> score;
          } 
          
          cout << endl<< endl;
          cout << " Number of score processed is " << count << endl ; 
    cout << " Sum of exam scores is" << sum << endl;
    
    if (count > 0 ) 
    {
              average =sum / count ;
              cout << " Average score is << average" << endl ;
              }
              system ("pause" );
              return 0 ;
              }




// get the data
void displayGrade ( int 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;

the problem is " expected unqualified ID ... return "" .... .
I don't know why, please help me
while (score != SENTINEL )
{
sum += score;
count++;
displayGrade(score);
cout << endl << "Enter the next score : " ;
cin >> score;
}
and I am not clear about this repetition, can you explain it to me in a simple way
thank you

Take away this line:

return displayGrade;

As for the loop, it will keep on prompting you for the next score, until you enter -1 then it will come out of the loop.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.