/*统计输入字符数*/ #include <stdio.h> int main(void) { int nc = 0; while (getchar() != EOF) { nc++; } printf("%d\n", nc); return 0; }
如我想在终端输入 abc后终止输入,该如何操作?
大家讲道理2017-04-21 10:59:21
Depends on whether you are under Win or Linux.
Under Win, CTRL+Z and press Enter
CTRL+D under Linux.