...

/

The User Move

The User Move

Learn how to take input from the user.

What we have

We have created a function to display the board. Here is the snap of the getMove() function, which calls the getUserMove() function.

Press + to interact
int getMove(char board[], int mode, char currentPlayer) {
int move;
if (mode == 1 && currentPlayer == 'O') {
move = getComputerMove(board);
cout << "Computer chose: " << move << "\n";
}
else {
move = getUserMove(currentPlayer, board);
}
return move;
}

Now, we need to ask for user input to place the markers “ ...