Welcome to HANGMAN You will be asked to guess the computer's secret word. The word will be displayed as a number of *'s. Every time you guess a letter correctly, that letter will be shown in its correct position in the word. If you guess incorrectly, the number of tries you have left will be decremented. You will be given a maximum of 7 incorrect guesses. ****** 7 turns left Enter a letter: t **tt** 7 turns left Enter a letter: a **tt** 6 turns left Enter a letter: s **tt** 5 turns left Enter a letter: e **tt*e 5 turns left Enter a letter: l **ttle 5 turns left Enter a letter: o *ottle 5 turns left Enter a letter: b Congratulations! You guessed the secret word: bottle.
Welcome to HANGMAN You will be asked to guess the computer's secret word. The word will be displayed as a number of *'s. Every time you guess a letter correctly, that letter will be shown in its correct position in the word. If you guess incorrectly, the number of tries you have left will be decremented. You will be given a maximum of 7 incorrect guesses. ********** 7 turns left Enter a letter: e ****e***** 7 turns left Enter a letter: r ****e***** 6 turns left Enter a letter: v ****e***** 5 turns left Enter a letter: s **s*e***** 5 turns left Enter a letter: t **s*et**** 5 turns left Enter a letter: d **s*et**** 4 turns left Enter a letter: i **s*et**** 3 turns left Enter a letter: m **s*et**** 2 turns left Enter a letter: o **s*et**** 1 turn left Enter a letter: p Sorry, no more turns left. The secret word was basketball.
You must initialize an array of strings (see section 7.10) to hold the computer's dictionary of secret words. The dictionary must contain at least 20 words of varying lengths. Use lower-case letters only for the words in the dictionary. The secret word will be chosen randomly from the dictionary every time a game of hangman is played.
Your program should contain at least one function that you have defined and designed yourself. (For example, the part of the program that reads in the user's next guess could be made into a function. Or the part of the program that updates the asterisks in the user's word so that the word contains all occurrences of the most recently-guessed letter could be a function.) Remember that one of the purposes of breaking a program up into functions is to make the main program more understandable. Whichever parts of your program you choose to implement as functions, you should provide pre- and post-conditions for your functions, and choose parameters, return types, and local variables appropriately.
Your program should behave as shown in the Sample Executions.
/cs/bin/turnin submit cs2301 PROJECT4 hw4.c README
Programs submitted after 5pm on November 23 will be tagged as late, and will be subject to the late homework policy.
Here is the grade sheet that the graders will use for this assignment.