notes on statistics
Finding min, max
There are at least two ways of finding min, max.
get the first number and assign it to both min, max. In other words, treat first number as a special case.
initialize min, max to their absolute minimum/maximum possible value
INT_MIN = minimum value for an int
INT_MAX = maximum value for an int
FLT_MIN = min value of a float
FLT_MAX = max value of a float
This discussion thread has good info. The second approach does not need to have a special case for the first number. It seems more elegant, but less intuitive.
Note that the _MIN or _MAX constants are defined in limit.h or float.h (need to confirm in c++)
Store n numbers
In order to count how many numbers are above average, we need to store the numbers somewhere. Typical C programming approach is to store the numbers in an array and remember how many elements are actually stored there.
A better solution is to use C++ vector. Vector is a self-contained array. It can change its size dynamically and it remembers its own size. Check out "push-back", "size", "at"....
Reading in n numbers
Console input is the most common method. cin >> count; then loop through all the following numbers.
Alternatively, count and numbers can be all inputed in one line using getline function. In other words, the user console input is stored in a string. The next step is to parse the user string into meaningful count and numbers. One method is to use stringstream and convert it to stream for >> processing. The other method is to use basic string "find" and "substr" functions.
** for the getline and parsing method, we probably do not need count. The user can just type in the numbers. We should be able to tell how many numbers are entered.
Real programs usually deal with files. It depends on the problem. It can be one line for all numbers or one number per line. I would recommend one number per line for now. In later exercises, we can have one customer per line or one object per line.