Need help with multidimensional arrays

Here is my code, I took on the project of making a text game then later adding graphics etc. but thats way ahead of time, I reviewed multi dimensional arrays, and came up with this code, this is as far as I could get, im just stuck in confusion.

#include <iostream>

using namespace std;
void charactermove();
const char width = 9;
const char height = 9;
int x;
int y;
class structure{
public:
int xs;
int ys;
char grass;
char wall;
};

int main()
{
//wals and stuff
structure grass;
grass.xs = 4;
grass.ys = 4;
grass.grass = '2';
structure wall;
wall.xs = 1;
wall.ys = 1;
wall.wall = '#';
int m;
int a;
unsigned char maze[width][height] = { '#', '1', '2', '0', '0', '0', '0', '0', '0',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0', '0', '0',
'0', '0', '0', '0', '0', '0', '0', '0', '0', };


x = grass.xs; & wall.xs;
y = grass.ys; &wall.ys;
//Assigning
maze[grass.xs][grass.ys] = grass.grass;
maze[wall.xs][wall.ys] = wall.wall;
//Assinging
cout << "Array Indices:\n";

for (m = 0; height < 10; m++) {
for (a = 0; width < 10; a++)
cout << maze[x][y];
cout << "\n";
cin.get();
}
cin.get();
}






Please help me out and correct the code, also explain why it works that way
Topic archived. No new replies allowed.