|
/*整个程序的作用就是把文件读到标准输出*/
#include<stdio.h>
int main()
{
FILE *fin=freopen("input.txt","r",stdin);//把input.txt文件作为标准输入
char temp[10];
while(gets(temp))
puts(temp);
return 0;
}
这样正常!!!
#include<stdio.h>
int main()
{
FILE *fin=freopen("input.txt","r",stdin);
char temp[10];
while(scanf("%s",temp)) //改了这两句
printf("%s",temp);
return 0;
}
这样就不正常了
比如input.txt文件为:
green
red
pink
0 |
|