Advertisement
Josif_tepe

Untitled

Jun 10th, 2021
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.92 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4.  
  5. void writeToFile() {
  6.   FILE *f = fopen("text.txt", "w");
  7.   char c;
  8.   while((c = getchar()) != '#') {
  9.     fputc(c, f);
  10.   }
  11.   fclose(f);
  12. }
  13.  
  14. int main() {
  15.    
  16.  //  writeToFile();
  17.     FILE *vlez = fopen("text.txt", "r");
  18.     char niza[1001];
  19.     int i = 0;
  20.     char c;
  21.     while(fscanf(vlez, "%c", &c)) {
  22.         if(c == '#') {
  23.             break;
  24.         }
  25.         c = tolower(c);
  26.         niza[i] = c;
  27.         i++;
  28.     }
  29.     int kolku_parovi = 0;
  30.     for(int j = 0; j < strlen(niza); j++) {
  31.         if((niza[j] == 'a' || niza[j] == 'e' || niza[j] == 'i' || niza[j] == 'o' || niza[j] == 'u') && (niza[j + 1] == 'a' || niza[j + 1] == 'e' || niza[j + 1] == 'i' || niza[j + 1] == 'o' || niza[j + 1] == 'u')) {
  32.             printf("%c%c\n", niza[j], niza[j + 1]);
  33.             kolku_parovi++;
  34.         }
  35.     }
  36.     printf("%d\n", kolku_parovi);
  37.     return 0;
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement