- #1
FallArk
- 127
- 0
I ran into some problems when trying to finish my assignment. The objective of this assignment is to create a block of code that will keep asking the user to input numbers until the input is 0. And if the user input 0 for the first value it will say "No data submitted!". I got all those parts, but the assignment also requires me to let the program output the highest and lowest value of all the input when the user input 0 (the user ended the program).
This is what I have done so far:
I don't really know how to rank the numbers, I think I should use array, but I'm not sure if the user then can input an infinite amount of values. Thanks in advance!
This is what I have done so far:
Code:
#include <iostream>
using namespace std;
int main() {
int input = 1;
cout << "Enter a number: ";
cin >> input;
if (input == 0) {
cout << "No data submitted!";
}
else {
while (input != 0) {
cout << "Enter a number: ";
cin >> input;
}
}
return 0;
}
I don't really know how to rank the numbers, I think I should use array, but I'm not sure if the user then can input an infinite amount of values. Thanks in advance!