For this lab, you will be expanding on the function example given in class. The example given in class computes the average for 3 doubles. You can find the source code here: example.cpp. To copy the example to your directory with the following command:
cp /home/fac/melissa/public_html/cs221-f09/example.cpp lab4.cppAlternatively, you can copy and paste the example like you did in Lab 1.
You will be expanding this code by adding a second function that will compute the standard deviation of the 3 doubles. The standard deviation is calculated using the following formula:
deviation = sqrt( ((num1 - avg)2 + (num2 - avg)2 + (num3 - avg)2) / 2)
where avg
is the result of calling average(num1, num2, num3)
.
You will need to do the following tasks:
main()
.
average
.
main()
which will say "The standard
deviation is " and then call your standard deviation function.