Question
C++ project will play the classic hangman game. The rules of hangman are: Ask the user for what word number the user wants to play.
C++ project will play the classic hangman game. The rules of hangman are: Ask the user for what word number the user wants to play. There is a file, word.txt, which will contain a list of words. The file will have 5 words in it, so if the user enters 0 then use the first word in the file and if the user enters 4 use the last word in the file. If the user enters -1, then you should randomly pick a word from the file. The file will have one word per line. Not all words will be the same length. Read the word into a string (or a character array). o Sample word.txt words moon sweater laugh forty Now you are ready to play the game, show the user blanks and the current state of the hangman. o Note that the letters (blanks or already guessed letters) are separated by spaces o _ e _ _ _ not _e___ Then let the user guess a letter. Everything in our game will be lowercase letters. If the user guesses a letter that is not in the word, then add another part to the hangman. If the user guesses correctly then change the blank to that letter. Continue the step above until either all letters in the word have been guessed or until you have completely drawn the hangman. Display a message to the user indicating whether the user won or lost and show the word too. Note - make sure you use plenty of functions!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started