Advertisement
TwiNNeR

3 vezhbi c

Dec 26th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.29 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5. void wtf() {
  6.     FILE *f = fopen("text.txt", "w");
  7.     char c;
  8.     while((c = getchar()) != EOF) {
  9.         fputc(c, f);
  10.     }
  11.     fclose(f);
  12. }
  13.  
  14. int soglaska(char c)
  15. {
  16.     c=tolower(c);
  17.     return !(c=='a' || c=='e' || c=='i' || c=='o' || c=='u');
  18. }
  19.  
  20. int main() {
  21.     wtf();
  22.     // vashiot kod ovde
  23.     FILE *vlez=fopen("text.txt","r");
  24.     char a[100][80];
  25.     int i=0, j=0, max_red=0, broj_momentalen=0, broj_max=0;
  26.     while(fgets(a[j], 80, vlez) != NULL)
  27.     {
  28.         for(i=0, broj_momentalen=0; i<strlen(a[j]); i++)
  29.         {
  30.             if(isalpha(a[j][i]))
  31.             {
  32.                 if(soglaska(a[j][i]))
  33.                 {
  34.                     broj_momentalen++;
  35.                 }
  36.                 else
  37.                 {
  38.                     if(broj_max<broj_momentalen)
  39.                     {
  40.                         broj_max=broj_momentalen;
  41.                         broj_momentalen=0;
  42.                         max_red=j;
  43.                     }
  44.                     else
  45.                     {
  46.                         broj_momentalen=0;
  47.                     }
  48.                 }
  49.             }
  50.         }
  51.         broj_momentalen=0;
  52.         j++;
  53.     }
  54.     printf("%d\n%s",broj_max,a[max_red]);
  55.     return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement