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