#include <iostream> #include "conio.h" using namespace std; int main() { while (true) { // 在此处填入需要循环的代码 cout<<"hello"<<endl; if (_kbhit()) // 如果有按键被按下 { if (_getch() == ‘\r‘) { break; } } } return 0; }
原文:https://www.cnblogs.com/liutianrui1/p/13283256.html