'My checkTie() function is not working correctly
I am working on my college project where we have to create a Tic-Tac-Toe game and I am completely made the game but for some reason, my checkTie() function is not working everything else is working completely fine. I can't find a solution to fix the problem. Can someone guide me through how I can fix it?
void checkTie(){
int tie = 0;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
if (board[i][j] == "")
{
tie++;
cout << "\n\n\t\tTIE!" << endl;
gamesPlayed++;
gamesTied++;
ttt.setGamePlayed(gamesPlayed);
ttt.setGameTied(gamesTied);
whoWon = "\n\n\t\tTIE!";
howWon = "\nThis was a Tie between Player and Computer!!";
ttt.setWhoWon(whoWon);
ttt.setHowWon(howWon);
ttt.writeResults();
displayBoard();
anotherTurn();
}
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|