Write a program that will let the user play Hangman. Setup Your program should p
ID: 642666 • Letter: W
Question
Write a program that will let the user play Hangman.
Setup
Your program should prompt the user to enter a word. If the user enters a word, that will be the word the player guesses.
If the user does not enter a word (i.e. they enter the empty string) you should prompt them for a URL. This URL will point to a page containing one line, a comma-separated list of words. You should use Random to select a word from the list.
Hint: Determine how many words are in the list, use this to select a random number in the appropriate range and index the list with the random number.
You may test with the following URL: https://cs1110.cs.virginia.edu/hangmanwords.txt
Suggested Approach
Create a display string with the right number of hyphens (loop and add one for each letter in the target word).
For each letter they guess,
If the letter is not in the target word, count a miss (the String class
Explanation / Answer
hangman.h
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.