Why the snake game coding get error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Why the snake game coding get error?

<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> </body> </html>include<iostream.h> #include<conio.h> #include<graphics.h> #include<dos.h> #include<stdlib.h> #include<stdio.h> #include<time.h> #include<string.h> class Snake { int p1,p2,v1,v2,v3,e1,e2,prev,now,n,colr,dsp,cnt,dly,m; int stp,egGen; int xr,yr; void caught(); public: long scr; int strtX,strtY,endX,endY; int pos[100][2]; void show(); void init(); void egg(); void transpose(); void gnrtCond(); void gnrtUnCond(); void check(); void checkEgg(); void move(); void chngDir(); void sndEt(); void sndCgt(); int test(); void score(); Snake(); Snake(Snake*); ~Snake(); }; Snake::Snake() { } Snake::~Snake() { } void Snake::checkEgg() { if((e1 == p1) && (e2 == p2)) {sndEt(); egg(); dly--; score(); n++; } } void Snake::sndEt() {nosound(); sound(2500); delay(2); nosound(); } void Snake::sndCgt() {nosound(); for(int x=1000;x>0;x--) {sound(x); delay(1); } nosou

2nd Jul 2020, 6:09 AM
Aayush Thole
Aayush Thole - avatar
6 Answers
+ 5
Hi Aayush Thole if you post a quetion about your code in the Q&A section, could you add the link to the actual code? So that it is easy for people to look at it. This is the best way to have meaningful answers!
2nd Jul 2020, 6:13 AM
ifl
ifl - avatar
+ 3
Please first edit your question and share your game's link in description
2nd Jul 2020, 6:11 AM
Arctic Fox
Arctic Fox - avatar
+ 3
... if it is C++ code it needs to be executed from the c++ section, Also the html code at the top needs to be removed.
2nd Jul 2020, 6:33 AM
ifl
ifl - avatar
0
Now I have coded my snake game
2nd Jul 2020, 6:24 AM
Aayush Thole
Aayush Thole - avatar
0
https://code.sololearn.com/W5pxeEyiWRWk/?ref=app i can see its c++ code, but you're using web pkayground
2nd Jul 2020, 6:26 AM
Taste
Taste - avatar
0
Ohk
2nd Jul 2020, 6:33 AM
Aayush Thole
Aayush Thole - avatar