hey im having trouble workin out the average it keeps showing 0 instead
#include<iostream>
using namespace std;
int main()
{
int count;
double grade, total, average;
grade = 0;
total = 0;
count = 0;
cout <<"\nTo stop entering grades. Type in the number";
cout <<"\n 999.\n\n";
total = total + grade;
cout << "Enter a grade: ";
cin >> grade;
count++;
while (grade != 999)
do
{
cout <<"\nEnter a grade: ";
cin >> grade;
if (grade < 0 || grade > 100 && grade !=999)
{
cout <<"\n Invalid grade has been entered"
<<"\nPlease check the grade and re-enter";
}
else
break; //break if a valid grade was entered
}
while(1); //this expression is always true
average = total / count;
cout << "\nThe average of the numbers is " << average << endl;
system("pause");
return 0;
}