Alx09

Help Moc

Jan 3rd, 2022 (edited)
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     char numar[30];
  8.     cout <<"Introduceti numarul: "; cin >> numar;
  9.     if(!numar[1]){
  10.         cout << "Numarul trebuie sa aiba doua cfire ce-l putin";
  11.         return 0 ;
  12.     }
  13.     for( int i = 0;  ; ++i)
  14.     if(!numar[i+1] || numar[i] < numar[i + 1]){
  15.         numar[i] = '\0';
  16.         cout << numar << numar + i + 1;
  17.         break;
  18.     }
  19.  
  20.     return 0;
  21. }
  22.  
Add Comment
Please, Sign In to add comment