Question: Write a program in C++ that reads a sequence of numbers from a text file named numbers.txt and then outputs information about the sequence to


Write a program in C++ that reads a sequence of numbers from a text file named numbers.txt and then outputs information about the sequence to a text file named output.txt. Output.txt will contain the amount of numbers in numbers.txt, the max number, min number, average, median, and a vertical bar chart of the values using asterisks. The bar chart will start with 0-10 and then go by groups of 9. Use functions instead of writing the entire program in main. Only use any of the following libraries: iostream, iomanip, cmath, string, fstream, sstream, vector, cstdlib, ctime, cctype, cstring. Example 1: numbers.txt is formatted: 9, 18, 48, 3, 5, 21, 28, 43, 0 output.txt is formatted: There are 9 numbers. The maximum is 48. The minimum is 0. The average is 21.88. //must have 2 decimal places The median is 19.5. Bar graph: 0-10 **** (4) //there are 4 numbers between 0-10 11-20 * (1) 21-30 ** (2) 31-40 (0) 41-50 ** (2) Example 2: numbers.txt is formatted: 3 output.txt is formatted: There is 1 number. The maximum is 3. The minimum is 3. The average is 3.00. I/must have 2 decimal places The median is 3. Bar graph: 0-10 * (1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
