C++中怎么在有输入时跳出循环,没有输入时循环继续?

2025-04-06 15:57:21
推荐回答(1个)
回答1:

头文件
#include 

判断方法
while(1)
{
// check input
if (_kbhit())
{
break;
}

// do something
cout << "aaaa" << endl;
}