Monday, May 24, 2010

C++ language problems?

what means by the numbers 72,77,75,80 from conway's game of life block codes illustrate below, isn't a arrow keys.


{


case 0:k0=getch();


switch(k0)


{


case 72:


if(y%26gt;1)


y--;


break;


case 80:


if(y%26lt;24)y++;


break;


case 75:


if(x%26gt;1)x--;


break;


case 77:


if(x%26lt;80)x++;


break;


}


i will gave 10pts if someone has effort to explain this

C++ language problems?
Complete list of keyscan codes for your reference, click the link below


https://www.glue.umd.edu/~nsw/ench250/sc...





We are using C++ getch() method from the iostream library to scan the key being pressed. You can also refer MSDN library for help on getch() method if you are using Visual Studio. Just select getch and press F1.





Good day bye
Reply:They're the arrow keys on the *numeric* keypad and with caps lock turned off. Pressing those keys returns two keys from getch(): a 0 followed by either 72 (up), 75 (left), 77 (right) or 80 (down).





The other arrow keys on the keyboard return -32 followed by the same extended codes.


No comments:

Post a Comment