Eddie_1337

5

Jun 6th, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     char x, max = '0' - 1, v[101]; int poz_max = -1;
  7.     gets_s(v);
  8.     if (v[0] >= '0' && v[0] <= '9') {
  9.         max = v[0]; poz_max = 0;
  10.     }
  11.     for (int i = 1; v[i] != '\0'; i++)
  12.         if (v[i - 1] == ' ' && v[i] >= '0' && v[i] <= '9' && max < v[i]) {
  13.             max = v[i]; poz_max = i;
  14.         }
  15.     if (poz_max >= 0)
  16.         for (int i = poz_max; v[i] >= '0' && v[i] <= '9'; i++)
  17.             cout << v[i];
  18.     else
  19.         cout << "NU EXISTA";
  20.     cout << '\n';
  21.     system("pause");
  22. }
Advertisement
Add Comment
Please, Sign In to add comment