Yes, I have the do while set to go on forever until I get on to the solving part, but while trying to shrink my program down so I can make it more modular, the O's that player 2 have are showing up as a face?

I know I have a logic error with the player 1 and 2 alternating, I'll get that fixed, but first I want to know why my O's are showning up as faces?

#include <iostream>
#include <iomanip>
using namespace std;

const gRow = 3;
const gCol = 3;

void showGrid(char grid[][gCol], int);
int changeValue(int, int);

int main()
{ char grid[gRow][gCol] =  {{'*', '*', '*'},
							{'*', '*', '*'}, 
							{'*', '*', '*'}};
	int rows, cols;
	int el = 1;
	int turn = 1;
	int num = 1;
	char player;
	
cout << "         TIC TAC TOE" << endl;
cout << "Player One: X    Player Two: O\n" << endl;

do {
	
showGrid(grid, gRow);

if (turn % 2)
	{player = 'X';}
	else {player = 'O' && num++;}

cout << "Player " << num << ", Enter the row and column:";
cin >> rows >> cols;
if (grid[rows-1][cols-1] != '*')
{cout << "This space is taken... Enter the row and column:\n";
cin >> rows >> cols; }
	
grid[rows - 1][cols - 1] = player;

turn++;
 
}
while(el = 1);


return 0;

}


void showGrid(char array[][gCol], int numRows)
{
    for (int row = 0; row < numRows; row++)
    {   for (int col = 0; col < gCol; col++)
        {
            cout << setw(2) << array[row][col] << " ";
        }
        cout << endl;
    }
}

Hmm not exactly sure what that would be happening, but there are still a couple things you need to change. At the top you should declare gRow and gCol as const int - I'm not sure how this even compiles with no type given. Also you should make a loop for getting input rather than an if statement in case the player tries to place a piece in an invalid spot more than once. Another thing to consider is making sure the player enters a valid row and column (between 1 and 3).

Sorry but your errors include : else {player = 'O' && num++;} And that is equivilent to

player = ('O' && num);
num++;

That means that player == 1 or 0, and both of those are interesting ascii characters to print :)

hope that helps.

Overall, laying out the code cleanly will greatly reduce errors like this.

Comments
Nice catch
This article has been dead for over six months. Start a new discussion instead.