Getting Started

As always, you may refer to Lab 1 if you need a reminder about how to start the Cygwin Terminal or Notepad++.

Begin by downloading CS101_Lab15.zip. Save the zip file in the H:\CS101 directory.

Start the Cygwin Terminal and run the following commands:

cd h:
cd CS101
unzip CS101_Lab15.zip
cd CS101_Lab15

Start the Notepad++ text editor. Use it to open the files

H:\CS101\CS101_Lab15\Stats.cpp

Your Task

Write a program that computes some simple statistics from user specified input. Your program should prompt the user to enter four integer values, and then compute the following statistical values based on the user input: the mean, the standard deviation, the maximum value, and the minimum value.

You must write the following four functions to perform the computation for these statistical values:

In all, your final program should have a total of five functions (the four above, plus your main function)

Example run (user input in bold):

Enter four integer values: 66 12 33 99

The mean of your values is 52.50
The standard deviation of your values is 33.03
The max of your values is 99
The min of your values is 12

When you are ready to compile the program, in the Cygwin window type the command:

make

To run the program, in the Cygwin window type the command

./Stats.exe

Computing standard deviation

From Wikipedia (standard deviation):

To compute the standard deviation of a set of numbers, such as those below:

image

first, find the mean of those numbers

image

then, compute the difference of each data point from the mean, and square the result of each (see hints below):

image

Finally, compute the average of these values, and the take square root to get the standard deviation:

image

In this example, the standard deviation is 2.

Hints

You may find it useful to use the pow(double x, double y) function in the math.h library: it computes xy (x raised to the power y). You can read more about the pow function here.

Submitting

When you are done, run the following command from the Cygwin bash shell:

make submit

You will be prompted for your Marmoset username and password, which you should have received by email. Note that your password will not appear on the screen.