@
mikewoo 抱歉,提问的时候思考的不充分,忘记说我输入字了也是毫无反应,
https://copy.com/OqsmhvxmDEWV这是我重新修改以后执行的,输入过也没有用。贴一下我重新修改的代码
#include <stdio.h>
main()
{
int c, i, nwhite, nother;
int ndigit[ 10 ];
nwhite = nother = 0;
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;
printf( "digits =" );
for ( i = 0; i < 10; ++i )
printf( " %d", ndigit[ i ] );
printf( ", white space = %d, other = %d", nwhite, nother);
}