#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).*/

lines 21 and 24: >> for(int x;x<width;x++)
You forgot the variable initializer. Should be like this: for(int x = 0;x<width;x++)

thanks a lot!

But i couldnt create the walls of the game and comile it could you help me
Ancient Dragon

line 17: the value of ch is undefined. Similar problem with all the other variables declared in that function. Variables have to be initialized with something before using them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.