用的VS2008写的C++,我敲得代码时:
#include
#include
using namespace std;
int main()
{
cout<<"piease input the b key to hear a bell.\n";
char ch=getche();
if(ch=='b')
cout<<'\a';
else
if(ch=='\n')
cout<<"what a boring select on...\n";
else
cout<<"bye!\n";
}无错误和警告,运行时按b和其他都是正确的反应,但是按回车时和其他的一样输出的是bye 这是为什么?是我按错键了还是其他原因。 请大家帮帮忙,谢谢。