Question: Assignment description: Write a C++ program that opens the file infile.txt and reads the numbers in the file. The user should see a menu with
Assignment description: Write a C++ program that opens the file infile.txt and reads the numbers in the file. The user should see a menu with choices to see the total, the average, the count, or the option to quit. Accept only choices 1-4 for the menu input using a do-while loop. Use a switch statement to calculate and display the sum, average, or count, or "We are done."
Sample output:
This program uses the numbers in the infile.txt file.
What would you like to know?.
1. Sum of the numbers
2. Average of the numbers
3. How many numbers there are
4. Quit
Your choice: 1
Total sum is :623988
Press any key to continue . . .
This program uses the numbers in the infile.txt file.
What would you like to know?.
1. Sum of the numbers
2. Average of the numbers
3. How many numbers there are
4. Quit
Your choice: 2
Average of the numbers is: 4991.9
Press any key to continue . . .
This program uses the numbers in the infile.txt file.
What would you like to know?.
1. Sum of the numbers
2. Average of the numbers
3. How many numbers there are
4. Quit
Your choice: 3
Count of the numbers is: 125
Press any key to continue . . .
This program uses the numbers in the infile.txt file.
What would you like to know?.
1. Sum of the numbers
2. Average of the numbers
3. How many numbers there are
4. Quit
Your choice: 4
We are done.
Press any key to continue . . .
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
