Tic tac toe c++
I created a tic tac toe game with a 2d array, but I needed to create it with a vector. I researched 2d vectors or the technical term "vector inside a vector", but I wasn't clear on how I could turn my code into a vector or if I would have to redo the whole program. Also, I need it to print draw or tie if no one wins, but it keeps running if the game is tied. Any advice would be greatly appreciated #include <iostream> using namespace std; char arr[3][3] = { '*', '*', '*', '*', '*', '*', '*', '*', '*' }; char player = 'X'; void Draw() { cout << "Tic Tac Toe " << endl; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { cout << arr[i][j] << " "; } cout << endl; } } void Input() { int a; cout << "Select a location: "; cin >> a; if (a == 1) arr[0][0] = player; else if (a == 2) arr[0][1] = player; else if (a == 3) arr[0][2] = player; else if (a == 4) arr[1][0] = player; else if (a == 5) arr[1][1] = player; else if (a == 6) arr[1][2] = player; else if (a == 7) arr[2][0] = player; else if (a == 8) arr[2][1] = player; else if (a == 9) arr[2][2] = player; } void TogglePlayer() { if (player == 'X') player = 'O'; else player = 'X'; } char Win() { //first player if (arr[0][0] == 'X' && arr[0][1] == 'X' && arr[0][2] == 'X') return 'X'; if (arr[1][0] == 'X' && arr[1][1] == 'X' && arr[1][2] == 'X') return 'X'; if (arr[2][0] == 'X' && arr[2][1] == 'X' && arr[2][2] == 'X') return 'X'; if (arr[0][0] == 'X' && arr[1][0] == 'X' && arr[2][0] == 'X') return 'X'; if (arr[0][1] == 'X' && arr[1][1] == 'X' && arr[2][1] == 'X') return 'X'; if (arr[0][2] == 'X' && arr[1][2] == 'X' && arr[2][2] == 'X') return 'X'; if (arr[0][0] == 'X' && arr[1][1] == 'X' && arr[2][2] == 'X') return 'X'; if (arr[2][0] == 'X' && arr[1][1] == 'X' && arr[0][2] == 'X') return 'X '; //second player if (arr[0][0] == 'O' && arr[0][1] == 'O' && arr[0][2] == 'O') return 'O'; if (arr[1][0] == '