hey guys, is it possible to use arrow keys in C++.
our proffessor wants us to make a 10X10 SOS game (if you know that game, it is similar to tictactoe difference is that instead of straight XXX need to be form the word (s-o-s) should be form instead).
anyway back to the topicl, arrow keys will be used so that the player (user) can choose a box where the letter 'S' or 'O' will be placed. my friend say there is a code/value that is needed. but i don't know what is the value of arrow keys. can any one help about it??? please
can arrow keys be used in C++arrow keys will need to be used in the output of the c++
Page 1 of 1
1 Replies - 9595 Views - Last Post: 29 February 2008 - 05:48 AM
Replies To: can arrow keys be used in C++
#2
Re: can arrow keys be used in C++
Posted 29 February 2008 - 05:48 AM
if you are making that on DOS then I think int86() should help you. It generates interrupt and from that you can get the value for key hit. Then map the value to see which key has been pressed [interrupt 22h I guess]. Seems bit difficult
Or easiest way is write a simple function which uses getch() and gives you the value of key pressed. [This is what I used to do for my assignments]
something like this
now use this code itself to get what are the values for your arrow keys [use mostly for special keys] and use them in your code.
I hope this will help you.

Or easiest way is write a simple function which uses getch() and gives you the value of key pressed. [This is what I used to do for my assignments]
something like this
int ch; ch = getch(); ch = getch(); printf("\nkey pressed = %d", ch);
now use this code itself to get what are the values for your arrow keys [use mostly for special keys] and use them in your code.
I hope this will help you.

This post has been edited by AmitTheInfinity: 29 February 2008 - 06:02 AM
Page 1 of 1