// two kbhit() examples
#include iostream.h // angle brackets don't show on HTML page
#include conio.h // contains kbhit
void main() {
int c,d;
while (!kbhit()) { // loop until keypressed
cout << "press a key" << endl;
}
d = getch(); // get key out of keyboard buffer
while (c != 'q') { // loop until lower case q
cout << "press a key - 2" << endl;
if (kbhit()) {
c = getch();
}
}
}