Question: write a c++ program that looks like this: Enter phrase: hello. Phrase: -----. Enter a guess: h Phrase: h----. Guessed so far: h Wrong guesses

write a c++ program that looks like this:

Enter phrase: hello.

Phrase: -----.

Enter a guess: h

Phrase: h----.

Guessed so far: h

Wrong guesses left: 7

Enter a guess: e

Phrase: he---.

Guessed so far: he

Wrong guesses left: 7

Enter a guess: l

Phrase: hell-.

Guessed so far: hel

Wrong guesses left: 7

Enter a guess: d

Phrase: hell-.

Guessed so far: held

Wrong guesses left: 6

Enter a guess: l

Invalid guess! Please re-enter a guess: 8

Invalid guess! Please re-enter a guess: o

Phrase: hello.

Guessed so far: heldo

Wrong guesses left: 6

Congratulations!!

Notes:

(user input has been bolded and underlined for emphasis; Note the two invalid guesses: l is invalid because it is already in the list of previously guessed characters; and 8 is invalid because it is not alphabetic Note also that the original non-alphabetic character . was not replaced by a dash)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!