This is a simple command-line implementation of the classic Tic Tac Toe game written in C++. The program allows two players to take turns marking X and O on a 3x3 grid until one of them wins or the game ends in a draw.
- Run the program in a C++ compiler or IDE.
- The game will display an empty 3x3 grid, with cells designated by numbers 1-9.
- Player X always goes first and will be prompted to enter the cell number of their move.
- Player X's move will be marked as X on the grid.
- Player O will be prompted to enter their move.
- Player O's move will be marked as O on the grid.
- Steps 3-6 will repeat until a player wins or the game ends in a draw.
- The game will display the winner and exit.
- Players take turns marking X and O on the grid.
- The objective is to get three of your marks in a row, column, or diagonal.
- The game ends when one player wins or the grid is filled without a winner (draw).
The program consists of the following files:
main.cpp
: Contains the main logic, game loop, and our array of board data.
This program has no external dependencies. It is written in standard C++ and should work with any modern C++ compiler.
To run the program, follow these steps:
- Clone the repository or download the source code files.
- Compile main.cc using a C++ compiler (e.g., g++).
- Execute the compiled binary to start the game.
Contributions are welcome! If you have any suggestions or improvements, feel free to submit a pull request.