Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<ctype.h>
- #include<stdlib.h>
- int samoglaski(char bukva)
- {
- tolower(bukva);
- if (bukva=='a'|| bukva=='e'|| bukva=='i' || bukva=='o' || bukva=='u')
- return 1;
- else
- return 0;
- }
- int main ()
- {
- FILE *fin;
- FILE *fout;
- int br=0,zbor=0,maxi=0,n,i;
- char str[100],str1[100];
- if((fin=fopen("tomas.txt","r"))==NULL)
- {
- printf("ne moze da se otvori");
- exit(1);
- }
- if(fout=fopen("tekst2.txt","w")==NULL)
- {
- printf("nemojt");
- exit(1);
- }
- while(fgets(str,100,fin)!=NULL)
- {
- n=strlen(str);
- i=0;
- while(i<n)
- {
- if(isalpha(str[i]))
- {
- br+=samoglaski(str[i]);
- }
- else
- {
- if(br%2!=0)
- {
- zbor++;
- }
- br=0;
- }
- }
- if(zbor>maxi)
- {
- maxi=zbor;
- for(i=0;i<n;i++)
- {
- str1[i]=str[i];
- }
- str1[i]='\0';
- }
- }
- fputs(str1,fout);
- fclose(fin);
- fclose(fout);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment