0

I cant get the output to display the average, high, and low. Any hints?

/*	Write a program that prompts the user for test
	scores (doubles). The user enters -1 to stop the
	entry. After all of the test scores have been
	entered, calculate the average, the highest and 
	the lowest test score. Use the code below as a 
	template. Make sure you respond appropriately 
	when no test scores are entered. Use the 
	following screen shots as a guide.
*/

#include <iostream>
using namespace std;
int main()
{
double scores[75];
int counter = -1;
do
{
counter++;
cout << "Please enter a score (enter -1 to stop): ";
cin >> scores[counter];
} while (scores[counter] >= 0);

}

I am very new at C++, I dont know where or how to add the High, Low, and Average in?

Any help would be greatly appreciated.

Thanks,
Mac

4
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by nmaillet
0

After the do-while loop is done you can calculate everything. You have the size of the set of scores, counter , so all you need to do is declare an integer as an index to use in a for loop, as well as three double's for the high, low and average.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.