Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <string.h>
- int samoglaska(char *c)
- {
- c = tolower(c);
- if( c == 'a' || c == 'e'|| c == 'i' || c == 'o' || c == 'u') return 0;
- else return 1;
- }
- int proverka(char *c)
- {
- if(strlen(c)>6)
- {
- if(samoglaska(c[0])&&samoglaska(c[strlen(c)-1]))
- return 1;
- }
- return 0;
- }
- int main()
- {
- FILE *fPointer;
- fPointer = fopen("test.txt","w");
- fprintf(fPointer,"ttvaaaat e dsmdedd za da vidime sedum osum devet deset.");
- fclose(fPointer);
- FILE *fPointer1;
- fPointer1 = fopen("test.txt","r");
- char ch;
- int brojac=0;
- char zbor[100];
- int vkupno=0;
- int voZbor=0;
- while((ch=fgetc(fPointer1))!=EOF)
- {
- if(isalpha(ch))
- {
- if(!voZbor)
- {
- voZbor=1;
- }
- zbor[brojac]=ch;
- brojac++;
- }
- else if(voZbor)
- {
- voZbor=0;
- zbor[brojac]='\0';
- if(proverka(zbor))
- {
- puts(zbor);
- vkupno++;
- }
- zbor[0]='\0';
- brojac=0;
- }
- }
- if(voZbor)
- {
- zbor[brojac]='\0';
- if(proverka(zbor))
- {
- puts(zbor);
- vkupno++;
- }
- }
- printf("Vkupno %d",vkupno);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement