A simple command-line implementation of the classic Hangman game in C++. Guess the letters of a hidden word before running out of attempts!
- Random Word Selection: The game randomly selects a word from a predefined list.
- User Interaction: The game prompts the user for letter guesses and provides feedback on their progress.
- Attempts Tracking: The game tracks the number of incorrect guesses and limits the number of attempts.
- Win/Loss Detection: The game detects when the user has either successfully guessed the word or run out of attempts.
- C++ compiler (e.g., g++)
- 📥 Clone the repository:
git clone https://github.com/pkprajapati7402/Hangman-Game.git
cd Hangman-Game
- 🏗️ Build the project:
g++ -o hangman main.cpp
- 🚀 Run the Hangman Game:
./hangman
When you run the Hangman Game, you will see a simple menu:
Welcome to Hangman!
Word: _ _ _ _ _ _ _ _ _
Attempts left: 6
Guessed letters:
Enter your guess:
- Enter a Guess: Type a letter and press Enter to guess a letter in the hidden word.
- Feedback: The game will inform you if your guess was correct or incorrect.
- Continue Guessing: Keep guessing letters until you either guess the entire word or run out of attempts.
- Winning: If you guess the word correctly, the game will congratulate you.
- Losing: If you run out of attempts, the game will reveal the hidden word.
main.cpp
: The main file containing the game logic.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes and commit them (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
This project is licensed under the MIT License.
- Inspired by the classic Hangman game.
Feel free to update or customize this README as per your project's requirements.