关于cin.get()的小问题!

来源:百度知道 编辑:UC知道 时间:2024/05/04 07:27:41
输出中途需停顿
if()
{
cout<<"按任意键继续";
cin.get();
}
怎么只有回车才会继续
按其它键不行啊!!
怎样实现?
#include <stdio.h>
if(/*判断条件*/)
{
system("pause");
}
朋友,你说的方法不行啊,我用的十vc6.0
提示说:error C2065: 'system' : undeclared identifier

回车用于判断输入结束,不按回车的话无法确定输入已经结束,所以光按其他键不会继续。
需要达到你的目的可以用下面的语句:
#include <stdio.h>
if(/*判断条件*/)
{
system("pause");
}
----------------------------------------------------------------------------------------------------------------------
需加头文件stdlib.h