#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()
猜你喜欢
转载自blog.csdn.net/moonlightpeng/article/details/80351802
今日推荐
周排行