Hello guys!I wonder if i could do something like if you press a key then make a sound with Beep() function included in <windows.h>.But i want that without need to press enter in console after entering that variable.
I don't think there's a standard way to do that without pressing enter.
On Windows, you may find the non-standard header <conio.h> and the function getch() or _getch().
#include <conio.h>
1 2 3 4 5 6 7 8
char ch;
while (ch = getch())
{
int nr = ch - '0';
// etc.
}
Here I converted from char to int merely for compatibility with the existing code. You could just test the value of ch directly instead - including alphabetic as well as number keys.