MIKOLAY Posted February 12, 2005 Report Share Posted February 12, 2005 Как сделать такую паузу в проге на С++, чтобы, например, при нажатии на <ENTER> что-либо происходило? Причём так, чтобы ничего невозможно было вводить, то есть std::cin.get() (без параметров) не устраивает. Quote Link to comment Share on other sites More sharing options...
troorl Posted February 12, 2005 Report Share Posted February 12, 2005 getch() предварительно нужно подключить библиотеку conio.h Quote Link to comment Share on other sites More sharing options...
MIKOLAY Posted February 13, 2005 Author Report Share Posted February 13, 2005 А если только при нажатии на <Enter>? Так, чтобы другие нажатия игнорировались. Quote Link to comment Share on other sites More sharing options...
aTeos Posted February 13, 2005 Report Share Posted February 13, 2005 Что-то в духе: char c; с = getch(); if (c == 0) { // делать что-то по нажатии Enter cout << "Enter was pressed"; } Quote Link to comment Share on other sites More sharing options...
MIKOLAY Posted February 22, 2005 Author Report Share Posted February 22, 2005 aTeos, не действует. Quote Link to comment Share on other sites More sharing options...
aTeos Posted February 23, 2005 Report Share Posted February 23, 2005 Так точно работает char c = getch();if (c == 13){ cout << "Enter pressed";} Quote Link to comment Share on other sites More sharing options...
MIKOLAY Posted March 8, 2005 Author Report Share Posted March 8, 2005 Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.