Coders Packet

Create a user friendly Tic Tac Toe Game using C++

By Anuja Barje

Tic Tac Toe also known as 'X' & 'O' game is a 3*3 grid game played between two players where each player is assigned with a 'X' and 'O' symbol respectively.

In this project, I have created a simple user friendly Tic Tac Toe game using C++ language. By using various if-else conditions, we can create this game played between two players. Each player is assigned with a 'X' and 'O' symbol respectively. The player who first creates a horizontal or vertical or diagonal sequence of Same symbol wins else its a draw. When you run the game you a interface this like.

Interface when you run the code

Here the Player1 is assigned with 'X' symbol and Player2 with 'O' symbol. The player needs to select the number between 1 to 9 to mark the symbol in the cell of that grid. You cant choose a number which iss already taken or out of the range of 1 - 9 else you get a message saying "Invalid move!!!!".

As the game proceeds , few of the cells are marked with symbols as shown below.

Interface while running the game

To win the Game you need to either create a horizontal, vertical or diagonal sequence of same symbol. When a player wins you get a interface like this showing a print message that which player has won.

Interface when a player wins

Thank you for reading...!!!

Download Complete Code

Comments

No comments yet