Simple Tic Tac Toe Game in C ++[0]After receiving a recommendation from the user Juho, I added this question to 2. I'm really new to programming, and I've made this simple tic tac toe application in python and c ++. Please tell me what can be improved Code: #understand #understand #understand using namespace std; vector toDraw {"1", "2", "3", "4", "5", "6", "7", "8", "9"}; // NOLINT (cert-err58-cpp) void reset (); void reDrawBoard (bool gameOver); int playerTurn = 1; int check (); // 0 – Game in progress; 1 – player 1 wins; 2 – the player 2 wins; int turnPlayed = 0; int main () { while (true) { reDrawBoard (false); chain entrance; int inputToInt; while (true) { input = ""; cin >> entrance; try { inputToInt = stoi (input); if (inputToInt> 9) { cout << " nInvalid Value. Try again."; cost << " nPlayer" + to_string (playerTurn) + ", Enter a number:"; Carry on; } } catch (exception and e) { cout << " nInvalid Value. Try again."; cost << " nPlayer" + to_string (playerTurn) + ", Enter a number:"; Carry on; } try { if (inputToInt == stoi (toDraw.at (static_cast)(inputToInt – 1)))) { Pause; } } catch (exception and e) { cout << "Position already occupied, please try again."; cost << " nPlayer" + to_string (playerTurn) + ", Enter a number:"; Carry on; } } if (playerTurn == 1) { draw[inputToInt – 1] = "X"; turnPlayed ++; playerTurn = 2; } other { draw[inputToInt – 1] = "O"; turnPlayed ++; playerTurn = 1; } int result = check (); if (result == 1) { reDrawBoard (true); cost << "THE PLAYER WINS !! n"; cost << "Would you like to play again? (Y/N): "; string response; cin >> answer; transform (response.begin (), response.end (), response.begin (), :: tolower); if (answer! = "y") { printf (" e[1; 1H[2J "); returns 0; } reset (); Carry on; } if (result == 2) { reDrawBoard (true); cout << "PLAYER TWO WINNER !! n"; cost << "Would you like to play again? (Y/N): "; string response; cin >> answer; transform (response.begin (), response.end (), response.begin (), :: tolower); if (answer! = "y") { printf (" e[1; 1H[2J "); returns 0; } reset (); Carry on; } if (toursPlayed == 9) { cost << "DRAW !! n"; cost << "Would you like to play again? (Y/N): "; string response; cin >> answer; transform (response.begin (), response.end (), response.begin (), :: tolower); if (answer! = "y") { printf (" e[1; 1H[2J "); returns 0; } reset (); } } } void reDrawBoard (bool gameOver) { printf (" e[1; 1H[2J "); cout << "TIC TAC TOE – Made by Khushraj (pseudo-sacred programmer) nPlayer 1 in X and player 2 is O n n | | n" + toDraw.at (0) + "|" + toDraw.at (1) + "|" + toDraw.at (2) + " n ___ | ___ | ___ n | | n" + toDraw.at (3) + "|" + toDraw.at (4) + "|" + toDraw.at (5) + " n ___ | ___ | ___ n | | n" + toDraw.at (6) + "|" + toDraw.at (7) + "|" + toDraw.at (8) + " n | | n n"; if (! gameOver) { cout << "Player" + to_string (playerTurn) + ", Enter a number:"; } / * * This prints (something similar to) – * * TIC TAC TOE – Manufactured by Khushraj * The player one is X and the player two is O * * | | * 1 | 2 | 3 * ___ | ___ | ___ * | | * 4 | 5 | 6 * ___ | ___ | ___ * | | * 7 | 8 | 9 * | | * * Player , Enter a number: * / } int check () {// 0 – Current game, 1 – Player 1 wins, 2 – Player 2 wins string un = toDraw

;
string two = toDraw[1];
string three = toDraw[2];
string four = toDraw[3];
chain five = toDraw[4];
chain six = toDraw[5];
string seven = toDraw[6];
chain eight = toDraw[7];
new string = toDraw[8];

// FOR THE PLAYER ONE
// If the player has 3X in a row, then
if ((one == "X" && two == "X" && three == "X") || (one == "X" && four == "X" && seven == "X") ||
(a == "X" && five == "X" && nine == "X") || (seven == "X" && five == "X" && three == "X") ||
(seven == "X" && eight == "X" && nine == "X") || (three == "X" && six == "X" && nine == "X") ||
(four == "X" && five == "X" && six == "X") || (two == "X" && five == "X" && six == "X")) {
returns 1;
}

// FOR PLAYER TWO
// If the player is 3 years in a row, then
if ((one == "O" && two == "O" && three == "O") || (one == "O" && four == "O" && seven == "O") ||
(a == "O" && five == "O" && nine == "O") || (seven == "O" && five == "O" && three == "O") ||
(seven == "O" && eight == "O" && nine == "O") || (three == "O" && six == "O" && nine == "O") ||
(four == "O" && five == "O" && six == "O") || (two == "O" && five == "O" && eight == "O")) {
returns 2;
}

returns 0;
}

void reset () {
turnPlayed = 0;
toDraw = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
playerTurn = 1;
}