Write an interactive C++ program that computes and outputs the mean and standard deviation of a set of four integer values that are input by the user. (If you did Programming Problem 2 in Chapter 3, then you can reuse much of that code here.) The mean is the sum of the four values divided by 4, and the formula for the standard deviation is
where n = 4, xi refers to each of the four values, and
is the mean. Although the individual values are integers, the results are floating-point values. Be sure to use proper formatting and appropriate comments in your code. Provide appropriate prompts to the user. The output should be labeled clearly and formatted neatly.
Program plan:
- Read four integers from the user.
- Calculates mean, using this find standard deviation.
- Display mean and standard deviation of four numbers.