Advertisement
hopingsteam

Untitled

Apr 22nd, 2020
500
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include    <iostream>
  2. #include    <cstring>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int nr = 0;
  9.     //char text[101] = "ei au plantat tamarix ea a adus iasomie";
  10.     char text[101];
  11.     cin.getline(text, 101);
  12.     char *cuv = strtok(text, " ");
  13.     while(cuv != NULL)
  14.     {
  15.         int voc = 0, cons = 0;
  16.         for(int i = 0; i < strlen(cuv); i++)
  17.             if(cuv[i] == 'a' || cuv[i] == 'e' || cuv[i] == 'i' || cuv[i] == 'o' || cuv[i] == 'u')
  18.                 voc++;
  19.         /*
  20.         for(int i = 0; i < strlen(cuv); i++)
  21.             if(strchr("aeiou", cuv[i]))
  22.                 voc++;
  23.         */
  24.         cons = strlen(cuv) - voc;
  25.         if(voc < cons)
  26.         {
  27.             cout << cuv << "\n";
  28.             nr++;
  29.         }
  30.         cuv = strtok(NULL, " ");
  31.     }
  32.     if(nr == 0)
  33.         cout << "Nu exista!";
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement