#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()
最新推荐文章于 2024-04-09 23:11:23 发布