该程序为什么不打印任何输出。Printf不打印输出
#include<stdio.h>
int main()
{
int c, i, nwhite, nother;
nwhite = nother = 0;
int ndigit[10];
for(i=0; i<10; ++i)
ndigit[i] = 0;
while((c = getchar()) != EOF)
if(c >= '0' && c <= '9')
++ndigit[c-'0'];
else if(c == ' ' || c == '\n' || c == '\t')
++nwhite;
else
++nother;
for(i=0; i<10; ++i)
printf("%d\n",ndigit[i]);
printf("%d - %d", nwhite, nother);
}
输入:它继续获得高达EOF输入。
所以,你试图输入一些输入和'EOF'? –
http://barbsbitsnbytes.com/pics/hammerd.jpg –
@SakthiKumar是的。 EOF是-1,我试过了,但它仍然不起作用。 – ajkumar25