How to make it so that when you press the ESC key, without pressing, then the Enter key, in Getchar (e), for example, the program ended?
Answer 1, Authority 100%
# include & lt; conio.h & gt;
if (_Getch () == 27)
{
EXIT (0);
}
By the way, if you want to intercept the Pressing ESC not only in the console, you can use the GetAsyncKeyState () from windows.h
for (int i = 0; i & lt; 255; i ++)
{
int state = getAsyncKeyState (i);
If (state == 1 || state == -32767 & amp; & amp; i == 27)
EXIT (0);
}