Advertisement
Spocoman

06. Max Number

Sep 10th, 2023
597
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     string input;
  8.     cin >> input;
  9.  
  10.     int bigNum = (-2147483647 - 1); // INT_MIN
  11.  
  12.     while (input != "Stop") {
  13.         int n = stoi(input);
  14.  
  15.         if (n > bigNum) {
  16.             bigNum = n;
  17.         }
  18.  
  19.         cin >> input;
  20.     }
  21.    
  22.     cout << bigNum << endl;
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement