Question
C++ Question!!! For this assignment you are to write a program that finds the minimum and maximum of a set of numbers entered by the
C++ Question!!!
For this assignment you are to write a program that finds the minimum and maximum of a set of numbers entered by the user. Your program should enter a loop in which it repeatedly asks the user to enter a number. The program should exit the loop if the user enters a -1. While in this loop, the program must keep track of the smallest and largest numbers entered by the user. After the user enters a -1 the program should output the minimum and maximum. Users may not enter any numbers less than 0 (other than -1 to stop) or greater than 9999.
Hint: Keep track of the current minimum and maximum in separate variables. Each time the user enters a number, you may need to update these variables.
After printing the minimum and maximum, your program should ask the user if they wish to continue by entering yes (y) or no (n). If they continue, your program should start over, if the user enters n, the program should quit.
In total, you should have two loop structures. (1) an outer loop controlling how many times the user repeats the entire program (Do you wish to continue?). (2) an inner loop that allows the user to repeatedly enter in numbers for which you will find the minimum and maximum.
Here is a sample of the input and output for your program. The user has entered text in red (bold) and the program has printed out text in black.
Your program should not accept any numbers less than -1 or greater than 9999 and should warn the user when they enter numbers out of this range. Your program should not exit just warn the user!
Hint: Attack this problem piece by piece. First get it to read in numbers until the user enters -1. Next, work on getting it to calculate the maximum and minimums. Only after you get those parts correct should you begin to work on getting the program to handle out of range numbers (warnings) and asking the user to continue (start all over) or q
> Please enter as many numbers as you like. Enter -1 to stop Please enter a number: 16 Please enter a number 46 Please enter a number 19 Please enter a number 6 Please enter a number: 98 Please enter a number 56 Please enter a number -1 Maximum: 98 > Minimum: 6 Do you wish to continue? (y): y > Please enter as many numbers as you like. Enter -1 to stop Please enter a number: 9 Please enter a number 128 Please enter a number: 18 Please enter a number -1 > Maximum: 128 >Minimum: 9 > Do you wish to continue? (y): n GoodbyeStep by Step Solution
There are 3 Steps involved in it
Step: 1
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