程序如下
#include<stdio.h>
int main()
{
freopen("input.txt","r",stdin);
int count=0;
char str[15];
while(fgets(str,15,stdin)!=NULL)
{
count++;
printf("%d:%s",count,str);
}
return 0;
}
input.txt文件中:Rbgggrrggbgr
Rrrbbbrrbbbr
Rbgrbgrrrrrg
Brbggrgbrbgr
brbggrgbgrrb
rgbgrbrrbgbg
brgrbgggbrbr
那么
为什么会有 8:
这一行呢?我是win7,codeblocks 与编译器有关吗?