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 proverka(char *c)
- {
- int i,j,vk=0;
- for(i = 0;i<strlen(c);i++)
- {
- vk=0;
- for(j=i;j<strlen(c);j++)
- {
- if(toupper(*(c+i))==toupper(*(c+j)))
- vk++;
- }
- if(vk>2)
- return 1;
- }
- return 0;
- }
- int main()
- {
- FILE *fPointer;
- fPointer = fopen("test.txt","w");
- fprintf(fPointer,"Ova e testt 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 vo_zbor=0;
- while ((ch=getc(fPointer1))!=EOF)
- {
- if (isalpha(ch))
- {
- if (!vo_zbor)
- {
- vo_zbor=1;
- }
- zbor[brojac]=ch;
- brojac++;
- }
- else
- if (vo_zbor)
- {
- vo_zbor=0;
- zbor[brojac]='\0';
- if (proverka(zbor))
- {
- puts(zbor);
- vkupno++;
- }
- zbor[0]='\0';
- brojac=0;
- }
- }
- if (vo_zbor)
- {
- zbor[brojac]='\0';
- if (proverka(zbor))
- {
- puts(zbor);
- vkupno++;
- }
- }
- printf("Vkupno %d zborovi.\n",vkupno);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement