Advertisement
Vlad020924

V80 2009 s2 ex5

Nov 17th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <cstring>
  4. using namespace std;
  5. char c[25];
  6. int main()
  7. {
  8.     int i,co=-1,vo;
  9.     char aux;
  10.     cin.getline(c,25);
  11.     for(i=0; i<strlen(c); i++)
  12.     {
  13.         if(strchr("aeiouAEIOU",c[i]))
  14.         {
  15.             vo=i;
  16.         }
  17.         else if(co==-1)
  18.         {
  19.             co=i;
  20.         }
  21.     }
  22.     if(co==-1 || strchr("aeiouAEIOU",c[vo])==0)
  23.     {
  24.         cout<<"IMPOSIBIL";
  25.     }
  26.     else
  27.     {
  28.         aux=c[co];
  29.         c[co]=c[vo];
  30.         c[vo]=aux;
  31.         cout<<c;
  32.     }
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement