
1 hector 2013 年 6 月 3 日 看了半天没懂是什么意思,我的是mvim,配置文件 https://github.com/myourys/Vimrc 然后一键编译运行 |
2 tywtyw2002 2013 年 6 月 3 日 贴出来代码呀? 可能是溢出了吧 或者其他的 |
3 Ricepig 2013 年 6 月 3 日 via iPhone 貌似gcc在osx上编译以后不是.out哇,看看有别的可执行文件? |
6 pagict 2013 年 6 月 3 日 贴代码 |
7 swulling 2013 年 6 月 3 日 和vim有啥关系 |
8 ivanlw 2013 年 6 月 4 日 getchar是接受输入的吧?你运行程序后就一直等待你输入,直到EOF吧 |
9 mikewoo 2013 年 6 月 4 日 统计字数的 你不输入字怎么统计呢?在等你输入呢,直到遇到EOF(Ctr+d) 还有有几处%d 你写成了&d了 |
10 W1nd OP @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); } |
13 xff1874 2013 年 6 月 4 日 别用vim,改sublime text2 |