This is a simple console-based Tic Tac Toe game written in C. Two players take turns to mark the grid, and the game checks for a winner or a draw after every move.
- Two-player mode
- Simple text-based UI
- Win/draw detection
gcc tictactoe.c -o tictactoe
./tictactoe- Open the file in Turbo C++.
- Compile and run the program.
- Players take turns entering a number (1-9) corresponding to the grid position.
- The game updates the board and checks for a winner.
- If all spaces are filled without a winner, the game declares a draw.
| |
1 | 2 | 3
_____|_____|_____
| |
4 | 5 | 6
_____|_____|_____
| |
7 | 8 | 9
| |
- The
system("cls")command is used for clearing the screen, which works on Windows but may needsystem("clear")for Linux. - Invalid input handling could be improved.
Feel free to fork this repository, report issues, or submit pull requests.
This project is licensed under the MIT License.
Developed by Harsh Arora