Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

asnswer question in c++ code as instructed. use comments to know whats your thinking as you do the problem. Write a C++ console application that

asnswer question in c++ code as instructed.
use comments to know whats your thinking as you do the problem.
image text in transcribed
image text in transcribed
Write a C++ console application that implements the classic pen and paper game hangman. If you are unfamiliar with the game, visit the wikipedia pagee and search the web to learn more. The main function is responsible for allowing the game to be played repeatedly and keeping track of win / loss counters that are displayed after each game. Main should call a separate boolean function that is responsible for playing 1 instance of the game. The game playing function should return true if the player wins the game and false otherwise. At the beginning of a new game, a random word is chosen (function) and the appropriate number of dashes are displayed (function). The player can try and guess the word or guess a letter in the word. If the word is correctly guessed, the player wins. If a letter is correctly guess, the letter is revealed when the word is displayed in dashed form. The player has a maximum of six incorrect guesses before running out of chances and losing Define a function that uses random number generation to return a hangman word from a short list of predefined possibilities. Start with a simple implementation that just uses a short if-else chain to randomly select among 5 possibilities. After studying vectors, use vectors in your implementation where indexing the vector using the random number retrieves the hangman word. The hangman words should be read in from a file and stored into the vector Define a struct to encapsulate all the data for the game into one data structure which includes the hangman word, a list of incorrect letter guesses (stored as a string or vector), a list of correct letter guesses, and the number of guesses so far. Create an object/instance of this struct inside the game playing function and update it accordingly as the game progresses. Define a function for displaying the current status of the game, including the hangman figurine, a dashed representation of the hangman word and a list of incorrect letter guesses. The display function should receive the game data struct as input and store it into a const reference parameter. To display the actual hangman using ASCII art, define a void drawing function that prints to given the number of incorrect guesses as an integer

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions