0

I want to use arrow keys to up and down between 3 options 1-game, 2-options,3- exit and exit its on 3rd option by clicking Enter

C++ using arrow keys

27th Jan 2019, 1:16 AM
مهرشاد روایی
مهرشاد روایی - avatar
2 Réponses
+ 1
First, make sure that conio.h is included. if(kbhit()){ char a=getch(); if(a == 72)//up arrow //do sth else if(a==80)//down arrow //do sth else if(a==13)//enter key if(choice == 1) //you must declare 'choice' Game(); else if(choice == 2) Options(); else return 0;//end program } That is my solution. Maybe there are some better solution👍
28th Jan 2019, 2:21 PM
LetterC67
LetterC67 - avatar
+ 1
Thank you very much
28th Jan 2019, 4:34 PM
مهرشاد روایی
مهرشاد روایی - avatar