_getche与getchar

版权声明:快乐源自分享,欢迎高手指正错误。 https://blog.csdn.net/gdnh22a/article/details/88050409

编译环境:VS2015

getchar(),输入字符后需要回车确认。

_getche(),输入字符后,不用回车确认。需要头文件<conio.h>

#include<conio.h>
        while (true)
        {
            const char c = _getche();
            if (c=='q' || c=='Q')
            {
                break;
            }
            std::this_thread::sleep_for(std::chrono::milliseconds(1));
        }

2019-3-1 10:25:16,友谊路。

猜你喜欢

转载自blog.csdn.net/gdnh22a/article/details/88050409