I see there are at least three errors in this program:
point[p1x][p1y] = 'o';
should probably usep2x
andp2y
instead- The check should be
if (wincheck(p1x, p1y)) loopexit = 1;
and the same for checkingp2x
/p2y
move - If move of player 1 ended the game you don't want to ask for the move of player 2.
The program as it is now is behaving strangely because you're calling the wincheck
function but are ignoring the result. Later your test
if (wincheck != false)
is not calling the function, but just reasoning about the function address and for some strange C++ rules it can unfortunately be compared to false
(the technical reason is that false
is a constant integral expression of value 0 and therefore can be intended to be the null pointer; why C++ has such a convoluted and strange rule for the null pointer is a secret no one really knows).