C++ keypress: getch, cin.get?

前端 未结 6 1136
逝去的感伤
逝去的感伤 2020-12-15 16:48

I have a Win32 program that runs on a loop. I would like to be able to pause that program while awaiting a keypress. It doesn\'t matter whether I use \'any key\' or a specif

6条回答
  •  情歌与酒
    2020-12-15 17:12

    You should #include and use std::cin.get();

    I think the getch() is a C function, but since you are using C++, then the cin would be more appropriate.

提交回复
热议问题