Snake game | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
26th May 2021, 6:19 AM
Suhel Nadaf
Suhel Nadaf - avatar
8 Answers
+ 3
Your kbhit function syntex is incorrect you should write ! instead of underscore . The function which u used kbhit it will not work on solo or you can write any other conditions until user press any key your program should end or you can use any other plateform its not standard function second thing your _getch() is showing undeclared i think it should be getch or getchar may be you are trying to input one char if yes then you can use getchar in place of getch. getch is also a non standard function which is defined in #include<conio.h> it will not work here . In modern ide you don't need to write getch () for screen pause
26th May 2021, 9:30 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
You can write any condition like this if user enter exit take this string as as input and compare it like this If(entered string=="exit") Then exit (0);
26th May 2021, 11:28 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
If we remove kbhit then what will we use?
26th May 2021, 11:34 AM
Suhel Nadaf
Suhel Nadaf - avatar
+ 1
Can you please tell me for which purpose u used it
26th May 2021, 11:37 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
Just for fun ha ha
26th May 2021, 11:44 AM
Suhel Nadaf
Suhel Nadaf - avatar
0
I use exit but how
26th May 2021, 11:45 AM
Suhel Nadaf
Suhel Nadaf - avatar
0
I used but still not running
26th May 2021, 11:45 AM
Suhel Nadaf
Suhel Nadaf - avatar
0
How to start it
26th May 2021, 12:07 PM
Suhel Nadaf
Suhel Nadaf - avatar