更新时间:2023-12-03 08:58:46
您应该在应用程序中注册按键事件(假设这是Windows GUI应用程序),而不是忙于查询按键,并检查按键您感兴趣.
Rather than busy-polling for a keypress, you should register for key events in your application (assuming this is a Windows GUI app), and check for the keys you're interested in.
如果您实际上是在制作控制台应用程序,请参见此处: C ++控制台键盘事件
If you are actually making a console app, see here: C++ console keyboard events