Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using C++ Write a program that reads a list of integers stored in a file and computes a count of how many times each number
Using C++
Write a program that reads a list of integers stored in a file and computes a count of how many times each number occurs in the data set. Specifically, your program should compute a count of how many times each integer number stored in the file occurs, and compute the standard deviation, average, minimum, and maximum value for the numbers stored in the file. You may assume that there is at least one number stored in the file, and that each value stored in the input file will range between 0 and 149 (so, algebraically: 0 x-149, for each number x stored in the input file). You may also assume that each of the numbers in the file will also be separated from each other by a space or new line, and that the input file will reside in the same directory as your program executable. Your program should declare, define and use a function or functions for finding the maximum value, minimum value from the data stored in the input file. Your program should also declare define and use functions to compute the arithmetic mean value (average), and standard deviation of the data stored in the input file For this assignment, the formula that you should use to compute the standard deviation is: Where xi is an individual value is the mean/expected value N is the total number of values Your program should prompt for the name of a file, and obtain the numbers from that file. The output should be written to the file named "statistics.txt". The output should be in the forma a two column list where the first column is a list of the numbers read in from the input file, the second column is the count of the number of times each number occurs the list of numbers from the file. Finally, the output should be sorted into descending order Note, you will need to create your own input files for testing. For example, if the file "nums.txt" contains the following values 12 3 5 2 30 98 3 7 5 12Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started