Advertisement
CoMoDoS

dasd

Apr 1st, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7.     printf("Hello world!\n");
  8.     FILE *f;
  9.     f=fopen("date.in","r");
  10.     int x=0,p,i;
  11.     char txt[20],buf[20];
  12.     char txt1[20][5];
  13.     fscanf(f,"%s",txt);
  14.     //puts(txt);
  15.     while ( fscanf(f,"%s",buf)==1 )
  16.     {
  17.         int ok=0;
  18.         for (i=0; i<x;i++)
  19.             if (strstr(txt1[i][5],buf))
  20.                 ok=1;
  21.         if (ok==0)
  22.         {
  23.             strcpy(txt1[x][5],buf);
  24.             if (strstr(txt,buf)!=NULL)
  25.                 p++;
  26.         }
  27.         x++;
  28.     }
  29.  
  30.     printf("%d",p);
  31.  
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement