#include <iostream>
#include <conio.h>
using namespace std;
void main()
{
while (true)
{
cout << "please enter a char " << endl;
//getchar()要按Enter才要生效
if ('q' == getchar())
{
cout << "hello poem" << endl;
break;
}
//这个输入后就生效
if ( ' ' == _getch()) //#include <conio.h>
{
cout << "hello poet" << endl;
break;
}
}
}
C语言缓冲区谈getchar()、getche()、getch()
getchar() 和getch()
最新推荐文章于 2021-05-13 16:51:57 发布