I have been looking for something to make it click in my head on how to get the average of my array and I need help.

``````#include <iostream>
#include <math.h>
using namespace std;

double average;
void main(){

cout << "Enter 10 test grades to average:"  <<endl <<endl;

for (a = 0; a < 10; a++){
cout << "Enter a grade: ";

}
while {
average = total/10;

cout << average  <<endl;
}

char wait;
cout << "Press any key followed by enter to exit. ";
cin >> wait;

return;
}``````

After some thinking I finally got it. Here is what I came up with.

``````#include <iostream>
#include <math.h>
using namespace std;

double average;
void main(){

cout << "Enter 10 test grades to average:"  <<endl <<endl;

for (a = 0; a < 10; a++){
cout << "Enter a grade: " ;
average = total/10;

}

cout <<endl;
cout << "Your average is: " << average <<endl <<endl;

if (average >=90) {
cout << "That is an 'A':";
}
else if (average >=80){
cout << "That is a 'B':";
}

else if (average >=70){
cout << "That is a 'C':";
}
else if (average >=60){
cout << "That is a 'D':";
}
else {
cout << "That is a 'F':";
}
cout <<endl <<endl;

char wait;
cout << "Press any key followed by enter to exit. ";
cin >> wait;

return;
}``````

Except you need to move the average calculation outside the for loop so it's not done each time. You should cast total to a double before the division so that your average isn't truncated.