該程序爲什麼不打印任何輸出。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