How to limit certain word in input

How to limit certain word only show when i press the correct button.

For example, I have 'x' and 'y' for the decision,
and I want to make only 'x' and 'y' will show in input,
while I press other button such as 'a', 'b', 'c' or 'd',
it will not show in input. Below are my desire output:

Output:
Do you wish to continue? (Y/N)_

//When I press button 'y' or 'n', it will show like below:
Do you wish to continue? (Y/N)n

//If I press button 'a', 'b', 'c' or 'd', it will show like below:
Do you wish to continue? (Y/N)_

//It will remains the same as without press button, the button I press just now will not show in input
Last edited on
This is not possible using only standard C++. You'll have to use some other library for that, like the WinAPI on Windows, or ncurses on unix-like operating systems.
@Peter87

Thanks for information ^.^
So does the codeblock include this WinAPI ??~~
Sorry I am beginner for C++ programming~~
Recently study at this part ~~
Yes, Code::Blocks (on Windows) comes with MinGW, that has the WinAPI. Of course, the WinAPI is fairly complicated, and if you haven't done much programming could be a bit much. Either look into things like pdcurses or ignore it and do something else for now.
Topic archived. No new replies allowed.