Question: 8. (20 points) Write a C++ program which prompts the user for an output file name and then reads a list of ten or fewer



8. (20 points) Write a C++ program which prompts the user for an output file name and then reads a list of ten or fewer positive integers into a vector called halfmax exe The input is terminated by the sentinel value-100. The program then finds the maximum integer in the list. Finally, the program outputs to both the screen and the specified output file the maximum integer followed by all list elements whose values are strictly greater than half the maximum. In the output file, you will write the maximum integer to the first line and the list of values greater than half the maximum to the second line Here is an example of running the program (user input is shown in bold) >halfmax exe Enter name of output file: out.txt Enter a list of ten or fewer positive integers ending with -100 4 7937 66-100 Maximum: 9 Integers strictly greater than 4.5: 79 76 6 > cat out.txt 79766 Important: To receive full credit you must: 1) use a vector to hold the input list, 2) write your solution in the main function below, and 3) implement the algorithm described in the comments. Assume the user will only enter positive integers, except for the sentinel value -100 of course. #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
