在我的代码中,我想检查在未输入输入值时是否按下回车键。因为,除非输入没有输入,否则通常按回车键才会换行;而在这种情况下,我想通过检测回车键来执行命令。通过“回车”键检查C++中的空输入检测
#include <iostream>
#include <string>
using namespace std;
int main(){
String str="";
while(str!="exit"){
cin>>str;
if(input is not entered and enter key is pressed)
continue;
else
break;
}
return 0;
}
我愿意接受任何建议。