Advertisement
Spocoman

07. Min Number

Sep 10th, 2023
698
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 smallNum = 2147483647; // INT_MAX
  11.  
  12.     while (input != "Stop") {
  13.         int n = stoi(input);
  14.  
  15.         if (n < smallNum) {
  16.             smallNum = n;
  17.         }
  18.  
  19.         cin >> input;
  20.     }
  21.    
  22.     cout << smallNum << endl;
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement