Skip to content

marvy-ian/cpp-console-based-hangman-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

C++ Hangman Game

A terminal-based Hangman game written in C++ that combines classic word guessing with programming-themed learning. Players can enjoy multiple game modes, use hints, track their score, and learn programming terms through built-in definitions.

Features

  • Single Player mode
  • Multiplayer mode
  • Custom Word mode
  • Programming-themed word categories
  • Hint system
  • Score tracking
  • ASCII Hangman animation
  • Used and remaining letter tracking
  • Randomized word selection
  • Word definitions after each game
  • Input validation

Categories

  • Programming Concepts
  • Data Types
  • C++ Keywords

Requirements

  • C++11 or later
  • Any C++ compiler
    • g++
    • MinGW
    • MSVC

Compilation

Using g++:

g++ main.cpp -o hangman

Run

./hangman

On Windows:

hangman.exe

Project Structure

.
├── main.cpp
├── README.md
└── CONTRIBUTING.md

How to Play

  1. Launch the game.
  2. Choose a game mode.
  3. Select a category if playing Single Player.
  4. Guess one letter at a time.
  5. Use ! to reveal a letter using a hint.
  6. Guess the complete word before running out of attempts.

Sample Output

A round of Single Player mode, Programming Concepts category:

==========================
        HANGMAN
==========================
1. Single Player
2. Multiplayer
3. Add Custom Word
4. Exit
Choose Option: 1

Choose Category:
1. Programming
2. Data Types
3. Keywords
Choice: 1
  +---+
  |   |
      |
      |
      |
      |
=========

Word: _ _ _ _ _ _ _ _
Attempts Left: 6
Score: 0
Hints Remaining: 2
Category Hint: Programming Concepts
Used Letters:
Remaining Letters: a b c d e f g h i j k l m n o p q r s t u v w x y z
Enter letter (! for hint): f
Correct!

  +---+
  |   |
      |
      |
      |
      |
=========

Word: f _ _ _ _ _ _ _
Attempts Left: 6
Score: 10
Hints Remaining: 2
Category Hint: Programming Concepts
Used Letters: f
Remaining Letters: a b c d e g h i j k l m n o p q r s t u v w x y z
Enter letter (! for hint): u
Correct!

...

Word: f u n c t i _ n
Attempts Left: 6
Score: 60
Hints Remaining: 2
Category Hint: Programming Concepts
Used Letters: f u n c t i
Remaining Letters: a b d e g h j k l m o p q r s v w x y z
Enter letter (! for hint): o
Correct!

You Win!
Word: function

Word Definition:
Function: reusable block of code.

Play Again? (y/n): n

Thanks for playing!

If attempts run out before the word is completed, the full hangman is drawn and the game ends instead:

  +---+
  |   |
  O   |
 /|\  |
 / \  |
      |
=========

Game Over!
The word was: function

Word Definition:
Function: reusable block of code.

Play Again? (y/n):

Future Improvements

  • Difficulty levels
  • Save high scores
  • Larger word database
  • Colored terminal output
  • Timed game mode
  • File-based custom word storage

License

This project is available for educational and personal use.

About

This C++ Hangman Game is a terminal-based word guessing game featuring Single Player, Multiplayer, and Custom Word modes. It includes programming-themed categories, hints, score tracking, ASCII hangman animations, randomized word selection, and word definitions, showcasing core C++ programming concepts in an interactive way.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages