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;
}
}