Lab Statistics

Basic Statistics

Overview

Control the input/output and display on terminal

Exercise looping and control structures.

Objective

Given a list of N integers, find its mean (as a double), maximum value, minimum value, and range. Your program will first ask for N, the number of integers in the list, which the user will input. Then the user will input N more numbers.

Here is a sample input sequence:

3 <--N 

2

1

3

Three numbers are given: 2, 1, 3. The output should be as follows:

Mean: 2    Max: 3     Min: 1     Range: 2

Note:

Practice "Control" section of http://www.cplusplus.com/doc/tutorial/control/

Input Format: 

Your program will loop on user input and print out basic statistics until user type 0 integers (i.e. N==0)

Output Format:

Floating point shall be printed accordingly.

Try the "width", "right", "left" with cout to format your output (optional)

More:

<+>  Instead of user typing 0 to terminate the program, can you handle other forms of termination?

<+>  try pyramid exercise