Question
Write a C - program that simulates a simple word-guessing game, similar to Hangman (without the pictures) or televisions Wheel of Fortune (without the money
Write a C - program that simulates a simple word-guessing game, similar to Hangman (without the pictures) or televisions Wheel of Fortune (without the money and prizes). The idea is that the program will think of a secret phrase, and the user will try to discover the phrase by guessing one letter at a time. For the purposes of this assignment, your program can have a single secret phrase that it uses each time the program runs. You may use any secret phrase you like, as long as it contains at least 15 characters, including at least one space (i.e., multiple letters).
After each guess, the program should show the current status of the users guesses, using dashes to indicates unguessed letters. For example, if the secret phrase is magical mystery tour and the user has already guessed the letters b, y, and t, then the program should display:
------- -y-t--y t---
Any spaces in the phrase should automatically be included (i.e., the user doesnt have to guess them).
You should keep track of the number of guesses the user makes. (If a user re-guesses a letter previously guessed, the new guess is still counted.)
If, after the 20th guess, the user still hasnt completely discovered the phrase, the program should display a consolation message and end the game. The consolation message should include the secret phrase.
If the user discovers the secret phrase by the 20th guess, you should display a congratulatory message, along with the number of guesses the user took.
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