random string or char array to matrix

Ey all.

Im folowing a c++ course and im stuck writing string or char arrays to matrices.

The problem is i have a matrix of size [i][j] with random values from 0 to 3.
Each of these values have to correspond to either a string or char array.

0=EMPTY
1=RES
2=SUS
3=KILL

Now i want to know if it is possible to either make use of enumarations since they already correspond to integer values like.

enum CELLTYPE {EMPTY, RES,SUS, KILL}
and then seed them in matrix randomly put i dont know how to do this.

I think it's much easier to just first seed matrix with 0 to 4 which i know how to do.
But then i cant convert the values to string or char. gives me error cant convert int to char if i do it like this.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
char usergrid(int rows, int col, int world[10][10])
{
	cout << endl;
	
	char EMPTY[] = "EMPTY";
	char SUS[] = "SUS";
	//string RES = "RES";
	//string KILL = "KILL";

	for(int i=0; i < rows ; ++i)
	{
		for(int j=0; j < col; ++j)
		{
			if (world[i][j] == 0)
				world[i][j] = EMPTY;
			else if  (world[i][j] == 1)
				world[i][j] = SUS;
			else if (world[i][j] == 2)
				//world[i][j] = RES;
			else if (world[i][j] == 3)
				//world[i][j] = KILL;
		}
	}
		for(int i=0; i < rows ; ++i)
	{
		for(int j=0; j < col; ++j)
			cout << world[i][j] << "\t";
		cout << endl;
	}

	return world[10][10];
}


plz help!!!!
Topic archived. No new replies allowed.