Lost the C++ code for this:

Here:


Enter name of data file: sample.txt

Read 1606 values from file.
Largest value = 870
Smallest value = 203
Mode value = 585
Average value = 503.082
Standard deviation = 101.204
...press any key to exit...


It took me a long time to write and cant remember hoe its done.

Note:this is not some type of homework or something like that.
If it's not homework, then I assume you aren't a college or high school student, and therefore I'd expect that you could easily cobble up the code in less than 30 minutes.

To compute the mode will require you to store all the values in memory in sorted order and then
choose the middle value (assuming an odd number of elements) or the average of the two
middlemost values (assuming an even number of elements).

STD dev = square root of ( sum of all values divided by number of values ).
Topic archived. No new replies allowed.