```
#include <iostream>
using namespace std;
int main ()
{
int i = 0;
string player1;
string player2;
string a1 = "-";
string a2 = "-";
string a3 = "-";
string b1 = "-";
string b2 = "-";
string b3 = "-";
string c1 = "-";
string c2 = "-";
string c3 = "-";
cout<< "---------------Tic-Tac-Toe---------------\n";
cout<< "\n 1 2 3\na "<< a1 <<"|"<< a2 <<"|"<< a3 <<"\nb "<< b1 <<"|"<< b2 <<"|"<< b3 <<"\nc "<< c1 <<"|" << c2 <<"|" << c3 <<"\n";
while (i < 9){
for (int x = 0; x < 1; x++) {
cout<<"\nPlayer 1 please insert the coordinates of your play. (I.E. b1)\n\n";
cin>>player1;
if (player1 == "a1") {if (a1 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {a1 = "x";}}
if (player1 == "a2") {if (a2 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {a2 = "x";}}
if (player1 == "a3") {if (a3 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {a3 = "x";}}
if (player1 == "b1") {if (b1 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {b1 = "x";}}
if (player1 == "b2") {if (b2 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {b2 = "x";}}
if (player1 == "b3") {if (b3 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {b3 = "x";}}
if (player1 == "c1") {if (c1 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {c1 = "x";}}
if (player1 == "c2") {if (c2 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {c2 = "x";}}
if (player1 == "c3") {if (c3 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {c3 = "x";}}
if (player1 != "a1" && player1 != "a2" && player1 != "a3" && player1 != "b1" && player1 != "b2" && player1 != "b3" && player1 != "c1" && player1 != "c2" && player1 != "c3") {cout<<"You must write the coordinate without spaces or capital letters. Please try again.\n"; x--;}
cout<< "\n 1 2 3\na "<< a1 <<"|"<< a2 <<"|"<< a3 <<"\nb "<< b1 <<"|"<< b2 <<"|"<< b3 <<"\nc "<< c1 <<"|" << c2 <<"|" << c3 <<"\n";
}
i++;
if ((a1 == "x" && a2 == "x" && a3 == "x") || (b1 == "x" && b2 == "x" && b3 == "x") || (c1 == "x" && c2 == "x" && c3 == "x") || (a1 == "x" && b1 == "x" && c1 == "x") || (a2 == "x" && b2 == "x" && c2 == "x") || (a3 == "x" && b3 == "x" && c3 == "x") || (a1 == "x" && b2 == "x" && c3 == "x") || (a3 == "x" && b2 == "x" && c1 == "x")) {i = 9; cout << "\nPlayer 1 Wins!";}
else {
if (i >= 9) {}
else {
for (int x = 0; x < 1; x++) {
cout<<"\nPlayer 2 please insert the coordinates of your play. (I.E. c2)\n\n";
cin>>player2;
if (player2 == "a1") {if (a1 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {a1 = "o";}}
if (player2 == "a2") {if (a2 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {a2 = "o";}}
if (player2 == "a3") {if (a3 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {a3 = "o";}}
if (player2 == "b1") {if (b1 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {b1 = "o";}}
if (player2 == "b2") {if (b2 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {b2 = "o";}}
if (player2 == "b3") {if (b3 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {b3 = "o";}}
if (player2 == "c1") {if (c1 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {c1 = "o";}}
if (player2 == "c2") {if (c2 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {c2 = "o";}}
if (player2 == "c3") {if (c3 != "-") {cout<<"The coordinate must be free. Please try again.\n"; x--;} else {c3 = "o";}}
if (player2 != "a1" && player2 != "a2" && player2 != "a3" && player2 != "b1" && player2 != "b2" && player2 != "b3" && player2 != "c1" && player2 != "c2" && player2 != "c3") {cout<<"You must write the coordinate without spaces or capital letters. Please try again.\n"; x--;}
cout<< "\n 1 2 3\na "<< a1 <<"|"<< a2 <<"|"<< a3 <<"\nb "<< b1 <<"|"<< b2 <<"|"<< b3 <<"\nc "<< c1 <<"|" << c2 <<"|" << c3 <<"\n";
}
if ((a1 == "o" && a2 == "o" && a3 == "o") || (b1 == "o" && b2 == "o" && b3 == "o") || (c1 == "o" && c2 == "o" && c3 == "o") || (a1 == "o" && b1 == "o" && c1 == "o") || (a2 == "o" && b2 == "o" && c2 == "o") || (a3 == "o" && b3 == "o" && c3 == "o") || (a1 == "o" && b2 == "o" && c3 == "o") || (a3 == "o" && b2 == "o" && c1 == "o")) {i = 9; cout << "\nPlayer 2 Wins!";}
i++;
}
}
}
cout<< "\n\n Game Over. \n\n";
cin.get ();
}
```