Hangman Game in C++ and python
By Sudepta Mallick
A simple Hangman game(Guess the word game).
This program can generate random words using a dictionary file and every time a new word will be given to the player.
Project: Hangman Game in C++
- Can Generate Random Words from Dictionary File.
- Can Play Hangman game.
- txt is Dictionary File used in game file and random word generator file.
Hangman Algorithm:
- Generate Random word and store in word variable;
- Get total number of letters in word variable store in word_size e.g., if word is test then word_size will be 4.
- Store total number wrong letter guess is store in worng_guess.
- Store guess letter in guess variable.
- Check guess letter is already attempted. Attempted again show a proper response.
- Check guessed letter is in the letter in word. If yes show all correct word. E.g. if guessed letter is t and word is test result should be like this t _ _ t. if guessed letter is not found in word show proper response. Correct guess letters store in correct_guess_letter in a proper sequence.
- Check word and guess correct_guess_letter match or not. If not repeat step 7. If yes show proper response and end the game.
Software used: Dev C++ 5.11,Notepad,Python IDLE 3.9.1
Comments