两个计数程序,为什么第一个程序比后一个要大1,计算的结果比输入的数的数目大一?
#include<stdio.h>main()
{
long nc;
nc=0;
while(getchar()!=EOF)
{
++nc;
printf("%ld\n",nc);
}
}
#include<stdio.h>
main()
{
double nc;
for(nc=0;getchar()!=EOF;++nc)
printf("%.0f\n",nc);
}
2013-06-21 18:11
2013-06-21 18:24
2013-06-21 19:13

2013-06-21 19:51
2013-06-22 11:09