character 2 dimensional array

Hello guys, as far as I understand im doing nothing wrong maybe I am :D why is this displaying weird lines instead of the letters X and O????

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 const int ROWS = 3;
	const int COL = 3;
	char board[ROWS][COL] = {{'O', 'X', 'X'},
	                         {'X', 'X', 'X'},
				 {'X', 'O', 'X'}};
	for (int x = 0; x < ROWS; ++x)
	{
		for (int y = 0; y < COL; ++y)
		{
			std::cout << board[ROWS][COL] << " ";
		}
		std::cout << "\n";
	}
	system("PAUSE");
	return 0;
I'm not sure about your 'weird lines', but you probably want line 10 to be:

 
std::cout << board[x][y] << " ";


Good luck!
hehe o yes offcaorse my bad :/ thanks man
Topic archived. No new replies allowed.