Hello! I am trying to create a tic tac toe game. I am receiving an error in both check player functions. The error message is "lvalue required as left operand assignment," not sure how to solve this so some help would be appreciated. Also, I know my code is majorly flawed, so any help on how to improve it would be awesome. Thank you!
#include <iostream>
using namespace std;
const int row = 3;
const int column = 3;
const int size = 9;
bool checkPlayer_x();
bool checkPlayer_o();
int xInput();
int oInput();
int main()
{
//display board
for ( int x = 0; x < row; x++)
{
for(int y = 0; y < column; y++)
{
cout << "Tic Tac Toe\n";
cout << board[x][y];
}
}
if(checkPlayer_x() == 1)
{
cout << "Player X wins!";
}
else if (checkPlayer_o() == 1)
{
cout << "Player O wins!";
}
else
{
cout << "Next player. \n";
}
}
int xInput()
{
cout << "Player X moves first." << endl;
int x, y;
cout << "Rows are labeled 1-3 and columns are labeled 1-3.\n";
cout << "Enter the number for the row first then column. \n";
cout << "Player X enter coordinates to make a move: ";
cin >> x >> y;
board[x][y];
//place x at this value
}
int oInput()
{
cout << "Player X moves first." << endl;
int x, y;
cout << "Rows are labeled 1-3 and columns are labeled 1-3.\n";
cout << "Enter the number for the row first then column. \n";
cout << "Player X enter coordinates to make a move: ";
cin >> x >> y;
// convergence to index
board[x][y];
//place x at this value
}