Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include <ctype.h>
- #define WORDLEN 21
- #define LINELEN 81
- #define bukva(c) isalpha(c)
- int ima_poveke_od2isti(char *w)
- {
- char *c;
- int isti;
- while(*w)
- { c=w+1;
- isti=1;
- while(*c)
- { if(tolower(*w)==tolower(*c))
- isti++;
- c++;
- }
- if(isti>2)
- return(1);
- w++;
- }
- return(0);
- }
- int main(int argc, char *argv[])
- {
- char zbor[WORDLEN],c;
- FILE *f;
- int iw=0,i=0,brzb=0;
- int ima2isti(char *);
- if(argc>2)
- { printf("Upotreba: %s ime_na_datoteka\n",argv[0]);
- return(-1);
- }
- if(argc==1)
- f=stdin;
- else
- if((f=fopen(argv[1],"r"))==NULL)
- { printf("Ne mozam da ja najdam datotekata %s\n",argv[1]);
- return(-1);
- }
- while((c=fgetc(f))!=EOF)
- { if(bukva(c))
- {
- if(!iw)
- iw=1;
- zbor[i++]=c;
- }
- else
- if(iw)
- {
- zbor[i]=0;
- if(ima_poveke_od2isti(zbor))
- {puts(zbor);
- brzb++;}
- zbor[i=iw=0]=0;
- }}
- printf("\nVkupno %d zborovi.\n",brzb);
- return (0);
- }
- //datoteka; proverva kolku zboroj imat po 2bukvi isti vnatre vo zborot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement