Advertisement
coregame

C Lab8 Check vowels

Oct 12th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1. #include<stdio.h>
  2. #define size 51
  3. int main() {
  4.     char text[size];
  5.     char c;
  6.     int sizearray = 0;
  7.     int vA = 0, vE = 0, vI = 0, vO = 0, vU = 0;
  8.    
  9.     while ((c = getchar()) != EOF) {
  10.         text[sizearray] = c;
  11.         sizearray++;
  12.     }
  13.  
  14.     for (int x = 0; x < sizearray; x++) {
  15.         switch (text[x]) {
  16.         case 'A': vA++; break;
  17.         case 'a': vA++; break;
  18.         case 'E': vE++; break;
  19.         case 'e': vE++; break;
  20.         case 'I': vI++; break;
  21.         case 'i': vI++; break;
  22.         case 'O': vO++; break;
  23.         case 'o': vO++; break;
  24.         case 'U': vU++; break;
  25.         case 'u': vU++; break;
  26.         }
  27.     }
  28.  
  29.     printf("a: %d\n", vA);
  30.     printf("e: %d\n", vE);
  31.     printf("i: %d\n", vI);
  32.     printf("o: %d\n", vO);
  33.     printf("u: %d\n", vU);
  34.     getch();
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement