C++ program for Tic-Tac-Toe game
kw.cpp
Output
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:~$
Advertisement