codeaft@codeaft:~$ g++ codeaft.cpp codeaft@codeaft:~$ ./a.out
__________
1 | 2 | 3
--+---+--
4 | 5 | 6
--+---+--
7 | 8 | 9
__________
Player "X" turn> 5
__________
1 | 2 | 3
--+---+--
4 | X | 6
--+---+--
7 | 8 | 9
__________
Player "O" turn> 1
__________
O | 2 | 3
--+---+--
4 | X | 6
--+---+--
7 | 8 | 9
__________
Player "X" turn> 3
__________
O | 2 | X
--+---+--
4 | X | 6
--+---+--
7 | 8 | 9
__________
Player "O" turn> 4
__________
O | 2 | X
--+---+--
O | X | 6
--+---+--
7 | 8 | 9
__________
Player "X" turn> 7
Player X wins!
__________
1 | 2 | 3
--+---+--
4 | 5 | 6
--+---+--
7 | 8 | 9
__________
Player "O" turn> q
Exit
codeaft@codeaft:~$
Comments and Reactions
Thank You
Dear User, Thank you for visitng Codeaft. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.