我有个TXT文件,里面包含10W个单词,要求,用户输入单词,在TXT文本中精确查找,并输出。我只学会了读取TXT文本
#include <stdio.h>
#include<stdlib.h>
int main()
{
FILE *fp;
char ch;
if((fp=fopen("C:\\Users\\hp\\Desktop\\words.txt","r"))==NULL)
{
printf("cannot open the file!");
exit(0);
}
ch=fgetc(fp);
while(ch!=EOF)
{
putchar(ch);
ch=fgetc(fp);
}
fclose(fp);
return 0;
}
叮当猫咪
紫衣仙女
相关分类