- 论坛徽章:
- 0
|
回复 24# Godbach
为什么在VC6.0下连续按两次CTrl + Z不会自动退出呢?
并且我觉得如果输入几个字符后再按一次Ctrl + Z相当于\n但是又不等价于\n
比如我这个程序
#include<stdio.h>
main()
{
int n_space,n_tab,n_enter;
int c;
n_space = n_tab = n_enter = 0;
while( (c = getchar()) != EOF)
if(c == ' ') ++ n_space;
else if(c == '\t') ++ n_tab;
else if(c == '\n') ++ n_enter;
printf("%d,%d,%d",n_space,n_tab,n_enter);
return 0;
}
运行后,如果我输入h e l,然后输入\t,然后输入一次Ctrl + Z(输两次或者更多次也是一样),都不会结束,此时再输入一次回车后,换到下一行的行首,又能够继续输入,如果这一次我输入Ctrl +Z的话,程序才会停止,并且我输入的那一次回车没有被算进去。
感觉有点混乱的感觉。。。 |
|