header

Lab 6

In this lab, you will write a program that will read numeric data from a text file and calculate the mean and the standard deviation. You will use void functions for the input and output and value-returning functions for the mean and the standard deviation.

Output Specifications

Display the description of a set of numeric data, the mean of the data values, and the standard deviation of the data values. Here is a sample run:

Input Specifications

The data is read from an input file whose name is specified by the user. The first line of the file contains a description of the data. The data is stored beginning on the second line and is white-space delimited (there is white-space between each data value and the next). The number of values is not known ahead of time. Here is a sample file:

SAT Math Scores
700
600
450
660
750

Process Specifications

Calculate the mean (x-bar) and standard deviation (s) of the data using these formulas:

Miscellaneous Specifications

Your program should include a void function whose only purpose is to read the data file, determine the number of data values, and find the required sums (the sum of the values and the sum of the squares of the values).

Note, a stream parameter (input stream or output stream) should be passed by address because it serves as an in/out parameter. It serves as an in parameter because the function needs the stream in order to do anything with it. It is an out parameter because when the function does something with the stream, it modifies the state of the stream and that modified stated must be passed back to the invoking routine.

Your program should include a value-returning function whose sole purpose is to calculate the mean given the number of values and the sum of the values.

Your program should include a value-returning function whose sole purpose is to calculate the standard deviation given the number of values, the sum of the values, and the sum of the squares of the values.

Your program should include a void function whose sole purpose is to display the program output.

I've started the program for you in the file Lab06.cpp. This file will not compile successfully until you have at least skeleton versions of each of the needed functions. You are not to make any modifications to my code. Just add your code. Don't forget to complete the  header comments for each function by adding parameter usage comment(s).