Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C++ console application that accepts up to five numbers from the user. Display all numbers, the highest, the lowest, and the average
Write a C++ console application that accepts up to five numbers from the user. Display all numbers, the highest, the lowest, and the average of the numbers. Ask the user if they want to continue entering another set of numbers. Requirements: 1. Comments are extremely important. Add comments as you code. Do NOT wait until you are done coding. Also, in the beginning of your codes include the following comments: Purpose of the program o Name of the author Date 2. Use proper naming conventions for your variables and functions (see handout). 3. Tell the user what the program is all about. Do NOT start the program with "Enter a number"!! 4. Create an array of five elements to store the numbers. 5. The user does not have to enter all five numbers. They can enter fewer. However, of course, you need at least two numbers to be able to look for the highest and the lowest. Make sure you explain this to the user. 6. Do not ask the user first how many numbers they want. The purpose of the assignment is for you to use proper logic to handle this task. 7. Create three functions to perform the following tasks: Get the values from the user. This function must also decide how many numbers the user has entered. Calculate the highest, the lowest, and the average. Hint: use reference parameters for min, max, and average. Print all results (all numbers, the highest, the lowest, and the average) 8. Pass the maximum number of elements to the function. The functions do not know how many numbers they should process. 9. All three functions must be called by the main, not other functions. 10. Keep track of the number of the values the user enters. Remember, they do not have to enter all 5 numbers. 11. Absolutely no global variables are allowed, including the array. 12. Do not use Magic Numbers. 13. The program must work correctly if you decide to change the number of possible values later. This program asks for up to 5 numbers. It then displays the numbers, the highest, the lowest, and the average. Please enter the first number: 87.93 Please enter the second number: 100 Would you like to add another number? Y/N: y Please enter #3 value: 77.34 Would you like to add another number? Y/N: Y Please enter #4 value: 7 Would you like to add another number? Y/N: n You entered: 87.93 100 77.34 7 Highest: 100 Lowest: 7 Average: 68.0675 Would you like to do it again? Y/N: y Please enter the first number: 777 Please enter the second number: 666 Would you like to add another number? Y/N: y Please enter #3 value: 11.2343 Would you like to add another number? Y/N: Y Please enter #4 value: -45 Would you like to add another number? Y/N: y Please enter #5 value: 5 You entered: 777 666 11.2343 -45 5 Highest: 777 Lowest: -45 Average: 282.847 Would you like to do it again? Y/N: n
Step by Step Solution
★★★★★
3.39 Rating (143 Votes )
There are 3 Steps involved in it
Step: 1
Heres a C console application that fulfills the given requirements include include Function to get v...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