#include using namespace std; int main(int argc, char* argv[]) { // GOOD PRACTICE: use const int variable to hold size // -- modifications in size require changing one place only // -- const prevents inadvertent modifications const int NUMBER_OF_TESTS = 5; double testGrades[NUMBER_OF_TESTS]; int index; double testSum = 0; double testAverageScore; cout << "Test Grade Analysis Program" << endl; cout << "Please enter the " << NUMBER_OF_TESTS << " grades, separated by spaces: "; // typical to use a for loop to iterate over positions in array // check bounds carefully! 0 - (size-1) for (index = 0; index < NUMBER_OF_TESTS; index = index+1) { cin >> testGrades[index]; } for (index = 0; index < NUMBER_OF_TESTS; index = index + 1) { testSum = testSum + testGrades[index]; } testAverageScore = testSum / NUMBER_OF_TESTS; cout << "Test average was " << testAverageScore << endl; }