Need some help with looping

I'm trying to get the user to input scores from 0 to 100 and then find the maximum and minimum and average of the scores.

I know I have to loop, but I'm not sure how to add the scores together so that I can get the average.

Also, I'm not sure how to find the min and max without knowing the values beforehand.

Can anyone maybe point me in the right direction?

I am very new to c++ and programming in general.
Any help would be awesome.
Hi,

one approach is that you store all the values entered by the user in a container, e.g. vector or a list.
After the user has finished the input you can calculate the average, min, and max.

Another way could be that you start with the lowest possible maximum and the highest possible minimum.
Then for each iteration you compare the input with min and max and change these values if appropriate.
Also sum up all inputs in a variable that you can than use to calculate the average (suppose you count the loop iterations).

Regards,
Mathes
Topic archived. No new replies allowed.