write, compile run a program that continously requests a grade to be entered. If the grad is less than 0 or more than 100 you program should print a message Invalid data . else the data should be added to the total. When a grade of 999 is entered, the program should exit the repition loop and compute and display the average.
#include <iostream>
usingnamespace std;
int main()
{
double average,total,grade;
int count = 0;
cout << "Please enter a grade: ";
cin >> grade;
while (grade!=999)
while (grade > 0 && grade <=100)
{
cout << "Please enter a grade: ";
cin >> grade;
total = total + grade;
count++;
}
cout << "SORRY INVALID TRY AGAIN:";
else
average = total/count;
cout << "Your total grade average is << average << endl;
system("pause");
return 0;
}
This obviously doesn't work and im stuck at this question for an hour?? anyone have a clue how to fix this? thanks.
1) You have an open quotes in line 25 without a close quotes.
2) You have a while loop without a "{" on line 12
3) You have an "else" on line 23 without an "if" anywhere in your program
cout << "Please enter a grade: ";
cin >> grade;
total = total + grade;
count++;
when i type any number 101 still asks for number doesn't say invalid code. when i type 999 it jumps to the end but also adds 999 to the average and i get a wierd error :/