Tic Tac Toe game help. Store rows and columns into a vector

Tic Tac toe game. Want to create a 3x3 table using vectors and then assign a row and column to it. For example top left is row 1 and column 1 (1,1). Maybe use a multi-dimensional vector

1
2
3
4
5
6
7
8
9
10
11
12
void printBoard(vector<vector<char>>& board) { //Defines function for board  

	vector<vector<char> > draw(3, vector<char>(3, '-')); //Attempt to create 3x3 Vector with '-'  
	for (int i = 0; i < draw.size(); i++) { //loop  
	cout << draw.at(i) << " "; //Prints out vector  
	}  
Output should look like this

    _  _  _ 
    _  _  _
    _  _  _ 
You need two nested loops. The inner loop prints the rows and when done print the end of line (either endl or '\n');
Topic archived. No new replies allowed.