problem:
I have seen this same code pasted around on here, but none of those threads specifically deal with my problem. I have been working on this for a few hours now and have run into an issue when I try to send the x and y values back to the board to print them out. I have tried multiple ways, sometimes getting weird characters and sometimes nothing. Maybe I do not fully understand the constructor stuff, I read my book and I have tried their way of doing it and resulted in program crash. If you give it a look and give me a hint on where my issue is I greatly appreciate it. Thanks.
assignment:
Write a program that allows two players to play the ticTacToe game. Your program must contain the class ticTacToe to implement a ticTacToe object. Include a 3-by-3 2d array as a private member variable, to create the board. If needed, include additional member variables. Some of the operations on a ticTacToe object are printing the current board, getting a move, checking if a move is valid, and determining the winner after each move. Add additional operations as needed.
I'm a newbie also, but watch for rem statements that might confuse you, for example your:
TicTacToe::TicTacToe(){
char TicTacToeBoard[3][3] = {{'!','!','!'},{'!','!','!'},{'!','!','!'} }; // fill board
TicTacToeBoard[p1x][p1y] = 'X'; // put x where p1 has coordinates
TicTacToeBoard[p2x][p2y] = 'O'; // put y where p1 has coordinates
Who is who here? It suggests you define that X and O are defined by player and not position on the board. =+S
This is my new code but still isn't working perfectly, but I am getting close. The problem now, is trying to determine the winner of the game. I thought I was doing it correctly, but it is not giving me the correct winner.
I don't know if you figured this program out yet, but I ran across an example in a book I was reading. The link I'm posting is a companion reference to the book that will (or should) bring you to a download link for the sourcecode in the book. The Tic-Tac-Toe example is in the Chapter 6 folder.
EDIT: DUH... It might help if I included the link.