Anyone knows this tip?
+2
A:
Return key is the easy case, as Mehrdad answered, just read something from std::cin
.
If you want to terminate on a different key press, for example, exit on any key, you can use a couple non-standard calls in conio.h
.
#include <conio.h>
// wait for any key press
while (!kbhit()) { }
// wait for q key press
while (!kbhit() || getch() != q) { }
// wait for any key press on windows
system("pause");
Inverse
2010-08-21 17:19:35