A few lines of the TicTacToe game:

Nov 16, 2018 at 1:24am
cout << "Invalid move ";
player--;
cin.ignore();
cin.get();
}
i = checkwin();
player++;
} while (i == -1);
board();
if (i == 1)
cout << "==>\aPlayer " << --player << " win ";
else
cout << "==>\aGame draw";
cin.ignore();
cin.get();
return 0;
}
//------------------------------------------------------------------------
This is a few lines of the TicTacToe game - Can anyone explain how the below line works?
i = checkwin();
//------------------------------------------------------------------------
Nov 16, 2018 at 1:59am
Hello samtheman,

Based on what you have "i" is being set to the return value of the function call "checkwin".

With out seeing the function "checkwin" my guess would be that "-1" means there is no win and "1" means a win.

Hope that helps,

Andy
Topic archived. No new replies allowed.