Question: Create a c++ program that: 1. Has a main() 2. includes the proper header and namespace declarations 3.Create a program using the following requirements: a.
Create a c++ program that: 1. Has a main()
2. includes the proper header and namespace declarations
3.Create a program using the following requirements: a. Write a program that requests the following from the user: 1. Enter file name and calculate average of values 2. Exit the program Place this inside a while loop that requests the user's choice from a menu until the user selects 2 . If the user selects 2, exit the loop and the program. b. If the user selects 1 write a looping code segment that reads as input UP TO 20 integer scores from a file (see below) and calculates and outputs (displays) their average. 1. If the file contains fewer than 20 scores, the program should STILL output the correct average. 2. If the file contains more than 20 scores, the additional numbers should be ignored. The average of 20 scores should STILL be calculated and output. 3. If the file is empty, the appropriate action should be taken and output a message. c. Create the appropriate variables for summing and averaging values, and the file name. d. Request the input file name from the user, input the filename, open the file and test for file state. If the file does not open successfully, output the appropriate message and exit the program. e. Download and use each of the following input files to test your program: 1. has-20.txt. Contains exactly 20 integers to test a above. 2. has-14.txt. Contains only 14 integers to test a1 above. 3. has-25.txt. Contains 25 integers to test a2 above. Also try this with a file that has no data. f. Close the file after the calculations and before requesting input from the user in the menu g. Include any displays to pause the program.
has txt14.exe =
20 30 40 55 56 57 12 22 23 34 33 45 67 65
has txt20.exe =
20 30 40 55 56 57 12 22 23 34 33 45 67 65 54 43 34 9 8 7
has txt25.exe=
20 30 40 55 56 57 12 22 23 34 33 45 67 65 54 43 34 9 8 7 12 33 55 66 77
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
