I'm building a tic tac toe game with a variable board size using class GameBoard and class GamePiece. The GamePieces have a char array, pName, for the player's name and a char pType for the piece (X or O).
the board is set up using a pointer to an array of pointers (**board).
My program crashes when I try to print the board to the screen after each move. Here's the code for the operator << overload and the code for my screen refresh...
Please help????
.h
friend ostream& operator<<(ostream& os, const GamePiece& p);
ostream& operator<<(ostream& os, const GamePiece& p)
{
os << p.pType << endl;
return os;
}
void GameBoard::RefreshBoard()
{
int row;
int col;
for (row=0; row < size; row++) {
for (col; col < size; col++) {
cout << " " << pieces[row][col].pType << " ";
}
cout << endl;
}
cout << endl << endl;
}