I'm very new to c++ and was asked to write a program using a while loop to calculate the average, it will keep asking for grades until you enter -1
so this is what i came up with which is clearly wrong.
please help me to right directions,
thank you all.
#include <iostream>
using namespace std;
int main (){
int grade; //declaring a variable
int t; // meaning the total number of grades
double average; // using double here because we are calculating for it
double total;
cout<< "What is your grade: "; // any number from 0 to 100
cin>> grade;
if (grade<0 || grade>100) cout<<" enter a number within 0 to 100
"<<\n";
else {
t += 1;
total = total + grade;
}
while (grade>=0 || grade <=100);
average = total / t;
cout<<" the average of your grades is: "<<"\n";