Question: Problem 5 ( Standard Deviation ) In business applications, you are often asked to compute the mean and standard deviation of data. The mean is

Problem 5(
Standard Deviation
)
In business applications, you are often asked to compute the
mean
and
standard deviation
of data. The mean is simply the average of the numbers and the standard deviation is a
3
statistic that tells you how tightly all the various data are clustered around the mean in a
set of data. For example, what is the average age of the students in a class? How close are
the ages? If all the students are the same age, the deviation is 0.
Write a program called
stddev.cpp
that allows users to enter
N
numbers (float) from
keyboard. Calculate and display the mean and standard deviation of those numbers. Your
program should report the message
Invalid value of N
if
N
0
Given the following fomulars:
mean
=
1
N
N
X
i
=1
x
i
=
x
1
+
x
2
+
+
x
N
N
deviation
=
s
P
N
i
=1
(
x
i
mean
)
2
N
1
/workspace/csc117/hw7
% g++-o out/stddev.out src/stddev.cpp
%./out/stddev.out
Enter the value of N: -4
Enter 10 numbers: 1.92.53.72163452
The mean is 3.11
The standard deviation is 1.55738
%./out/stddev.out
Enter the value of N: -4
Invalid value of

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!