#include <iostream>
using namespace std;
void Outputgrade(double avg);
int const SENTINEL = -1;
int main()
{
int i = -1;
double num = 0, sum = 0, avg;
do
{
i++;
sum += num;
cout <<" Please enter grades in percent (0-100) or -1 to terminate: ";
cin >> num;
while( ((num < 0) || (num >100)) && (num != SENTINEL))
{
cout << "you have entered an invalid value please re-enter: ";
cin >> num;
}
}while(num!= SENTINEL);
avg = (sum/i);
Outputgrade(double avg);
return 0;
}
void Outputgrade(double avg)
{
cout << "The average score for this midterm is :";
if(avg < 50)
cout << "F";
else if (avg <= 60)
cout << "D";
else if (avg <= 70)
cout << "C";
else if (avg <= 80)
cout << "B";
else if (avg <= 95)
cout << "A";
else
cout << "A+";
}
Thats my program that calculate the midterm average in term of a,b,c...etc.
i can't compile because of the following error.
missing ')' before type double ( at Outputgrade(double avg); )
and 'Outputgrade' :function does not take 0 parameter.
anyone could help me?