Home  >  Q&A  >  body text

eclipse 终端 如何 终止 输入

/*统计输入字符数*/
 #include <stdio.h>
 
 int main(void)
 {
 	int nc = 0;
 	while (getchar() != EOF) {
 		nc++;
 	}
 	printf("%d\n", nc);	
 
 	return 0;
 }

如我想在终端输入 abc后终止输入,该如何操作?

巴扎黑巴扎黑2737 days ago645

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理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.

    reply
    0
  • Cancelreply