为什么cout在vc++ getche()之前不起作用。 6.0?
我想在输入之前显示一条消息:
cout<<"Enter a char:";
ch = getche();
但是,运行程序时不会显示消息,getche()
有效,之后显示了消息!!!
整个程序:
#include <iostream.h>
#include <conio.h>
int main(){
int ch;
cout<<"Enter a char:";
//cin.ignore();
ch = getche();
return 0;
}
我想做的整个问题是:
1- show a message
2- enter ONLY one char
3- do something immediately after entering the char
I want to show a message before an input :
cout<<"Enter a char:";
ch = getche();
But when running program it does not show the message and getche()
works and after that the message is showed !!!
The whole program :
#include <iostream.h>
#include <conio.h>
int main(){
int ch;
cout<<"Enter a char:";
//cin.ignore();
ch = getche();
return 0;
}
The whole problem that, i want to do is this:
1- show a message
2- enter ONLY one char
3- do something immediately after entering the char
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加
endl
宣布了问题:Adding
endl
soleved the problem :