Lab 4.4 - Hangman

The Hanged Man

Hangman is a word game that allows players to make guesses about the letters in a word, with a limited number of wrong guesses allowed.

Write an application that plays Hangman with the user.

When the Play button is clicked, the program should ask for a word that will be the correct answer (use an input box). Then, the program should display a number of dashes equal to the number of letters in the word. The program will ask the user to guess a letter (also using an input box), subtracting one from the Guesses Remaining if it does not appear in the word, and displaying the letters in their proper places in the displayed word if it is correct. The program will continue to ask for letters until the user runs out of guesses, or inputs an exclamation point (!) as input.

The ! means that the user is ready to guess the word. If the user enters a !, use an input box to get the user's guess. Compare it with the answer string in a case-insensitive context. Use a message box to tell the user whether he or she was correct, and the number of guesses taken.

Make sure your program is user-friendly, with good prompts and labels.

HINTS: Use the various String functions to check and build strings. You're going to have a For-Next loop nested inside a Do-Loop-While loop. Delve deeply into your notebook: this one uses a lot of stuff we've already covered.