Question: Write a letter guessing game in C. The user is allowed a maximum number of guess (choose something reasonable). If they don't get all the
Write a letter guessing game in C. The user is allowed a maximum number of guess (choose something reasonable). If they don't get all the letters after those guesses, then they lose the game. In that case, write a suitable message t the screen and reveal the mystery word. If they do guess all the letters, they win the game. Print a suitable message along with the total number of guesses. A sample output is shown below. Word Guessing Game Try #1 Please pick a letter: e Try #2 Please pick a letter: i Try#3 Please pick a letter: a -a-e-a- Try#4 Please pick a letter: s -ase-a- Try #5 Please pick a letter: p -ase-a Try #6 Please pick a letter: m -ase-a Try #7 Please pick a letter: b baseba-- Try #8 Please pick a letter: 1 basebal1 You got it!!! in 8 guesses Hint: 1. Create two strings (character arrays): The first contains the mystery word. The second is an array of all dashes (as many letters as letters in the mystery word). Every time the user correctly guesses a letter, replace the dash in the dash array with the letter. 2. The main loop here is a while game loop, since we don't know how many turns it will take. But inside the game loop, after the user makes a guess, you will need a for loop to check each letter in the mystery word for matches. One loop inside another loop is called a nested loop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
