| | |
could you help me to compile this snake game in c++
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2009
Posts: 3
Reputation:
Solved Threads: 0
C++ Syntax (Toggle Plain Text)
#include<iostream> using std::cout; using std::cin; using std::endl; #include<conio.h> class Mouse { public: void move(); void turn(); }; void Mouse::move() { char ch; int length; int width; switch (ch) { case '1': cout<<"To move forward"; for(int y;y==length;y--) break; case'2': for(int x;x<width;x++) break; case'3': for(int x;x>0;x--) break; } } void Mouse::turn() { for(int a=0;a<200;a++) cout<<a<<"^"<<(char)23<<endl; } int main() { int length,width; cout<<"Please enter the width of the room:"; cin>>width; cout<<"Please enter the length of the room:"; cin>>length; int ** myArray = 0; myArray = new int*[length]; if (myArray != NULL) { for (int i = 0; i < length; i++) { myArray[i] = new int[width]; cout<<"X"; } } for(int x=0;x<width;x++) { for(int y=0;y<length;y++) myArray[x][y]=0; } cout<<length<<"x"<<width<<"x"; int x,y; if(x<4&&y<4){ myArray[3][4]=1; myArray[1][3]=1; } else cout<<"you entered wrong obstacles"<<endl; getch(); return 0; }
/*The compilergives this runtime error could you solve the problem about it?
'hgh.exe': Loaded 'C:\Users\medion\Documents\Visual Studio 2008\Projects\hgh\Debug\hgh.exe', Symbols loaded.
'hgh.exe': Loaded 'C:\Windows\System32\ntdll.dll'
'hgh.exe': Loaded 'C:\Windows\System32\kernel32.dll'
'hgh.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb\msvcp90d.dll'
'hgh.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb\msvcr90d.dll'
Run-Time Check Failure #3 - The variable 'x' is being used without being initialized.
Run-Time Check Failure #3 - The variable 'y' is being used without being initialized.
First-chance exception at 0x00241a0f in hgh.exe: 0xC0000005: Access violation writing location 0xabababbb.
Unhandled exception at 0x00241a0f in hgh.exe: 0xC0000005: Access violation writing location 0xabababbb.
First-chance exception at 0x00241a0f in hgh.exe: 0xC0000005: Access violation writing location 0xabababbb.
Unhandled exception at 0x00241a0f in hgh.exe: 0xC0000005: Access violation writing location 0xabababbb.
First-chance exception at 0x00241a0f in hgh.exe: 0xC0000005: Access violation writing location 0xabababbb.
Unhandled exception at 0x00241a0f in hgh.exe: 0xC0000005: Access violation writing location 0xabababbb.
First-chance exception at 0x00241a0f in hgh.exe: 0xC0000005: Access violation writing location 0xabababbb.
Unhandled exception at 0x00241a0f in hgh.exe: 0xC0000005: Access violation writing location 0xabababbb.
First-chance exception at 0x00241a0f in hgh.exe: 0xC0000005: Access violation writing location 0xabababbb.
Unhandled exception at 0x00241a0f in hgh.exe: 0xC0000005: Access violation writing location 0xabababbb.
First-chance exception at 0x00241a0f in hgh.exe: 0xC0000005: Access violation writing location 0xabababbb.
Unhandled exception at 0x00241a0f in hgh.exe: 0xC0000005: Access violation writing location 0xabababbb.
The program '[3028] hgh.exe: Native' has exited with code 0 (0x0).*/
Last edited by Ancient Dragon; Jul 13th, 2009 at 7:25 pm. Reason: add code tags
![]() |
Similar Threads
- Snake game...it's difficult. Need assistance to comlpete it in Simplest way (Java)
- Snake Game (Game Development)
- Help!!! Snake game program, this is what i got so far. (Java)
- snake game S.O.S (C++)
- please help in this snake game today please (C++)
- Snake game with parameters and it wont work... (Pascal and Delphi)
- Please help me with a java terminal snake game (Java)
- array problem in java "Snake game" (Java)
- Snake Game (Pascal and Delphi)
- [MERGED]can anybody help me with this problem; snake game (Java)
Other Threads in the C++ Forum
- Previous Thread: MySQL Stored procedure call in c++
- Next Thread: Cannot run OpenCV
Views: 413 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






