I am struggling with this program that wants to ask the user how many grades they wish to enter, have the user enter each grade, then determine the average of all the grades. I am stuck with getting the average to computer correctly... Can you guys check to see what I am missing in my code?
int main() { //No Local constants int counter = 0; //While Loop counter //Local variables int totalGrades; //Max number of loop executions int runningTotal; //Running total of loop counter int grade; int average; //Average of grades char endProgram; //Pause screen /*************** Begin main Function Executables *****************/ //Clear the screen system ("cls"); //Prompt user for number of grades they want to enter cout << "How many grades would you like to enter? "; cin >> totalGrades; while (counter < totalGrades) //stop when counter equals value of totalGrades { runningTotal = counter + grade; cout << "Please enter the next grade ---> "; cin >> grade; counter = counter + 1; // increase counter by 1 } //end while loop average = runningTotal / totalGrades; //compute average cout << average << " is the average of the grades entered." << endl; //Pause to read output cout << "\n\n"; //skip 2 lines system("pause"); //Indicate to OS successful termination of program return 0; }//end main