Question: this is the current code i have for C + + to make a tic tac toe game but when I try to execute it
this is the current code i have for C to make a tic tac toe game but when I try to execute it it doesn't leave an X or a O in the slots the player picks and i need some help?
#include
#include
#include
#define SIZE
#define EMPTY
void initializeBoardint boardSIZESIZE
int num ;
for int i ; i SIZE; i
for int j ; j SIZE; j
boardij num;
void printBoardint boardSIZESIZE
printf
;
for int i ; i SIZE; i
for int j ; j SIZE; j
if boardijEMPTY
printf;
else
printfd boardij;
if j SIZE printf;
printf
;
if i SIZE printf
;
printf
;
int checkWinint boardSIZESIZE
for int i ; i SIZE; i
if boardi boardi && boardi boardi return boardi;
if boardi boardi && boardi boardi return boardi;
if board board && board board return board;
if board board && board board return board;
return EMPTY;
int checkTieint boardSIZESIZE
for int i ; i SIZE; i
for int j ; j SIZE; j
if boardij EMPTY return ;
return ;
int main
int boardSIZESIZE;
int currentPlayer, choice, row, col, winner, playAgain;
char symbolsXO;
srandtimeNULL;
do
initializeBoardboard;
currentPlayer rand;
winner EMPTY;
while
printBoardboard;
printfPlayer c enter your choice: symbolscurrentPlayer;
scanfd &choice;
if choice choice
printfInvalid choice! Please choose a number between and
;
continue;
row choice SIZE;
col choice SIZE;
if boardrowcol EMPTY
printfInvalid choice! Please choose an empty cell.
;
continue;
boardrowcol EMPTY;
ifwinner checkWinboard EMPTY
printBoardboard;
printfPlater c wins!
symbolswinner;
break;
currentPlayer currentPlayer;
printfDo you want to play again? for yes, for No: ;
scanfd &playAgain;
while playAgain;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
