Advertisement
Cieslin

PPZnaki_2

Nov 20th, 2017
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.97 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <conio.h>
  3.  
  4.  
  5. int main()
  6. {
  7.     while (true)
  8.     {
  9.         char slowo[30];
  10.         int a = 0, e = 0, x = 0, o = 0, u = 0, y = 0;
  11.         printf("Wprowadz dowlony tekst. q lub Q - konczy wprowadzanie znakow.\n");
  12.         scanf("%s", &slowo);
  13.         if (slowo[0] == 'Q' || slowo[0] == 'q')  
  14.             break;
  15.         for (int i = 0; i < sizeof(slowo); i++)
  16.         {
  17.             if (slowo[i] == 'a' || slowo[i] == 'A')
  18.                 a++;
  19.             if (slowo[i] == 'e' || slowo[i] == 'E')
  20.                 e++;
  21.             if (slowo[i] == 'i' || slowo[i] == 'I')
  22.                 x++;
  23.             if (slowo[i] == 'o' || slowo[i] == 'O')
  24.                 o++;
  25.             if (slowo[i] == 'u' || slowo[i] == 'U')
  26.                 u++;
  27.             if (slowo[i] == 'y' || slowo[i] == 'Y')
  28.                 y++;
  29.         }
  30.         printf("Liczba samoglosek\n");
  31.         printf("a = %d\n", a);
  32.         printf("e = %d\n", e);
  33.         printf("i = %d\n", x);
  34.         printf("o = %d\n", o);
  35.         printf("u = %d\n", u);
  36.         printf("y = %d\n", y);
  37.         printf("---------------------------------------------------------------------------\n\n");
  38.     }
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement