kodingwindow@kw:~$ g++ kw.cpp kodingwindow@kw:~$ ./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
kodingwindow@kw:~$
Comments and Reactions
Advertisement
Thank You
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.