Explore BrainMass
Share

C++ program to compute mean and standard deviation

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

Design and write a C++ program that reads a set of scores from the file scores.dat and outputs their mean and standard deviation on standard output. Use the following sets of input for testing the program.

Data: 56, 35, 87, 18, -34, 46, 0
Data: 82, 23, 52, 83, 91, 48, 72, 78, 74, 0

Please note that 0 is a sentinel value (indicating the end of numbers input), so it should not be used in computations.

© BrainMass Inc. brainmass.com March 21, 2019, 9:17 pm ad1c9bdddf
https://brainmass.com/computer-science/cpp/cplusplus-program-compute-mean-standard-deviation-369339

Solution Preview

Please find an implementation attached as 369339.cpp . It computes population standard deviation, however it is mentioned in the comments in the code as to what little change you can make to compute sample standard deviation instead.

While putting the data in input file, ...

Solution Summary

Attached is program computes population standard deviation, however it is mentioned in the comments in the code as to what little change you can make to compute sample standard deviation instead. Program has been designed to take the input file name as command line argument.

$2.19