#include "string.h"
#include "ctype.h"
#include "stdio.h"
search(char pd[])
{FILE *fp;
int time=0,i=0,j=0,add[80],k=0,m;
char *ch,
str[900];
m=strlen(pd);
if((fp=fopen("haha.txt","r"))==NULL)
{
printf("Cannot open this file\n");
exit(0);
}
for(;!feof(fp);i++)
{
str[i]=fgetc(fp);
if(tolower(str[i])==tolower(pd[k]))
{k++;
if(k==m)
if(!isalpha(i-m)&&!isalpha((str[i++]=fgetc(fp))))
{
time++;
add[j]=i-m+1;
j++;
k=0;
}
else k=0;
}
}
if(time)
{
printf("The time is:%d\n",time);
printf("The adders is:\n");
for(i=0;i
標簽:
查詢學會少年宮
上傳時間:
2016-12-29
上傳用戶:767483511