字符计数问题!
#include <stdio.h>main()
{
long nc;
nc = 0;
while(getchar() != EOF)
++nc;
printf("%ld\n", c);
}
问题1:为什么while循环里没有"{}"可以不需要吗?
问题2:我执行程序后,我输入了abcd,回车,怎么什么都没有呢?
问题3:后来我按ctrl + z 出现了数字“5”,应该是4个字节数,怎么变5个了?
2009-11-11 01:27
2009-11-11 01:32
程序代码:#include <stdio.h>
main()
{
long nc;
nc = 0;
while(getchar()!= '\n')
++nc;
printf("%ld\n", nc);
getch();
}注意下 像2L说的问题就可以了 
2009-11-11 08:30
2009-11-11 09:02
2009-11-11 10:40
2009-11-11 14:04
2009-11-11 14:15
2009-11-11 15:43