I already posted about this and I think my explanation of my question was too confusing. If you would allow me to explain it one more time in a more clear manner...
So I believe that the problem lies in the function printBoard. I am trying to make it so that the following occurs when the user inputs 1.
1 2 3
4 5 6
7 8 9
O 2 3
4 5 6
7 8 9
However, it is not working and I do know why. If you can offer some suggestions to solve this problem, that would be awesome.
P.S. Do not worry about the two functions nearing the end of the code.
If you can answer the following question, I think that would solve this problem. Why doesn't the value assigned to 'j', one of the parameters of the printBoard function, transfer over to its function. For example, for the first time the loop is run, j is initialized as 0. However, when j does not actually go through the function. So if I tried to write "cout << board[j]" inside the printBoard function, it does not work. I hope I made my self clear. If I did not, please let me know.
I've seena lot of tic-tac-toe posts on this forum and this is one of the more confusing ones I've seen.
1) Why are you even passing j to printBoard? printBoard should print out the board as it exists. There should be no need to pass it a subscript.
2) Not clear why you have two arrays. You can easily convert a binary number to a displayable character: char c = n + '0';
3) Lines 2-10: What is the purpose of this loop? If you're trying to determine which cells have been played, shouldn't you also be placing 'X's for display?
4) Lines 29,36: Why is the user inputting directly to board? You should be prompting for a square, then edit checking that the number is valis and that the square is not occupied.
My suggestion is to rename numbers to board. Get rid of board as an int array. printBoard should take one argument: board