fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int input;
  6. int greatest;
  7. int lowest;
  8.  
  9. cout << "Enter a number from 0 -99. Enter -99 when you are done.\n";
  10. cin >> input;
  11.  
  12. lowest = input;
  13. greatest = input;
  14.  
  15. while (input != -99)
  16. {
  17. if (input < lowest )
  18. {
  19. lowest = input;
  20. }
  21.  
  22. if (input > greatest)
  23. {
  24. greatest = input;
  25. }
  26.  
  27. cin >> input;
  28.  
  29. }
  30.  
  31. cout << "Lowest number is " << lowest << endl;
  32. cout << "Greatest number is " << greatest << endl;
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0s 5284KB
stdin
2
6
67
34
45
4
324
523
7
61
-9
-99
stdout
Enter a number from 0 -99. Enter -99 when you are done.
Lowest number is -9
Greatest number is 523