Write a function that takes five (5) doubles as input and passes back both the mean and the standard deviation (both doubles).
If you are comfortable passing in an array of doubles instead, that's great.
The mean and standard deviation are a common calculation in statistics to express the range of "typical" values in a data set. This brief article explains how to calculate the standard deviation: http://www.mathsisfun.com/data/standard-deviation.html (Just the first part, up to where it says "But … there is a small change with Sample Data".
Use the pow
and sqrt
functions from
the cmath
library in your function.
Pay attention! You are passing back the two calculated values
not printing them to the screen! The only place cin
and cout
might appear in this problem is in
the main
function where you test your function!