cin >> UsersChoice;

so I've been going through the beginners exercises and am working my way through them, problems solving what I can and asking for help with what I can't...

So here's whats up, I've been practicing making programs that ask the user to input certain data or even simple yes no answers... ex: would you like to play again? [Y/N]: cin >> Choice;... it's simple.

so my question is, is it possible to make it so that the user can select "yes" or "no" using the arrow keys and then pressing enter? ...ok I know it's possible some how to do it in C++, so to be more specific, is this something I can do in a simple console application? or is this something more advanced?

if so then where should I be looking to learn how?

thanks...
Basically it boils down to using a third party library that does most of the work for you. Here's one:

http://en.wikipedia.org/wiki/Ncurses

C++ doesn't provide its own standard libraries for user interface. For instance:

http://www.parashift.com/c++-faq/move-cursor-on-screen.html
if you're comfortable with CLI, there's an easy way to identify exactly what key was pressed in the keyboard, i just can't remember how (i have a reference, but no time to read it), you can use this to accomplish your goal.
Thanks guys... i'll take a look at the links
if you're comfortable with CLI, there's an easy way to identify exactly what key was pressed in the keyboard

Hmm... maybe you're thinking about kbhit() from the conio.h library?

Be advised, conio.h is not part of standard C++.

http://en.wikipedia.org/wiki/Conio.h
@Catfish4:
Hmm... maybe you're thinking about kbhit() from the conio.h library?


no i didn't know about this function, i don't even know how it works.

i was talking about a class in CLR programming that represents a keyboard button, the reference i read is really great, i just read it quickly long time ago, i'm trying to start off understanding basic C++ then i can move to .NET programming.
i really hope i could remember how to use this class.
i read the article you provided, and it says:
kbhit - Determines if a keyboard key was pressed.

it didn't specify that it returns information about what keyboard button was pressed, this makes it useless in this domain.
Topic archived. No new replies allowed.