Write a program with a loop that lets the user enter a series of integers. The user should enter -99 to signal the end of the series. After all the numbers have been entered, the program should display the largest and smallest numbers.
I used a for loop to let the user enter their numbers, and i have it set so that when -99 is entered, it ends it, however, my problem lies in whether i need to add something to this loop, or do something else entirely.
I dont have any clue as to how i can find out which number was the largest and which was the smallest,here is my code so far.
#include<iostream>
usingnamespace std;
int main()
{
int UserNumber;
int UserChoiceCount = 1;
cout << "The Greatest and Least of These.\n\n";
cout << "Please enter as many numbers as you like, when you \n";
cout << "are done I will show you the largest and smallest of \n";
cout << "the numbers you entered.\n\n";
for (int count = 0; count < 1; UserChoiceCount++)
{
cout << UserChoiceCount << ") enter a number \n";
cout << "(enter -99 when you are done) \n";
cin >> UserNumber;
cout << "\n\n";
if (UserNumber == -99)
break;
}