Advertisement
hopingsteam

Untitled

May 22nd, 2020
1,432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include    <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     char s[100];
  8.     char sFinal[200] = "";
  9.     cin.getline(s, 100);
  10.     char *cuvant = strtok(s, " ");
  11.     while(cuvant != NULL)
  12.     {
  13.         char auxi[50];
  14.         strcpy(auxi, cuvant);
  15.         for(int i = 0; i < strlen(auxi); i++)
  16.         {
  17.             if(strchr("aeiou", auxi[i]))
  18.             {
  19.                 strcpy(auxi + i + 1, auxi + i);
  20.                 i = i + 1;
  21.             }
  22.         }
  23.         if(auxi[0] >= 'a' && auxi[0] <= 'z')
  24.             auxi[0] = auxi[0] - 'a' + 'A';
  25.  
  26.         int lungime = strlen(auxi) - 1;
  27.         if(auxi[lungime] >= 'a' && auxi[lungime] <= 'z')
  28.             auxi[lungime] = auxi[lungime] - 'a' + 'A';
  29.  
  30.         strcat(sFinal, auxi);
  31.         strcat(sFinal, " ");
  32.         cuvant = strtok(NULL, " ");
  33.     }
  34.     strcpy(s, sFinal);
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement