繁体   English   中英

Printf不打印输出

[英]Printf not Printing the output

为什么该程序不打印任何输出。

#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。

尝试这个:

for(i=0; i<10; ++i)
        printf("%i\n",ndigit[i]);
    printf("%i - %i", nwhite, nother);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM