求助!
Introduction
You are required to write a C++ program called hang.cpp which plays a simplified version of the game HangTheMan. A secret word is "generated" and the length of the word is indicated by a string of stars of the same length (which we shall call the solution string). A player then tries to guess the word by entering one letter at a time. Each time a letter in the secret word is guessed correctly the corresponding stars in the solution string are replaced by that letter. The program should terminate when either all letters have been guessed correctly or there have been 10 incorrect guesses.
Generating the Secret Word
Ideally the program should access a random word from the system dictionary. However to keep it simple our program will prompt the user for a secret word and then the screen is cleared and the (other?) user tries to guess the secret word.
Sample Input and Output
Welcome to HangTheMan
Enter the secret word baboon
[ screen is cleared by displaying 100 empty lines]
Wrong Guesses = 0
******
Letter? a
Wrong Guesses = 0
*a****
Letter? e
Wrong Guesses = 1
*a****
Letter? i
Wrong Guesses = 2
*a****
Letter? o
Wrong Guesses = 2
*a*oo*
Letter? u
Wrong Guesses = 2
baboo*
Letter? n
You win! You guessed it with 2 incorrect guesses
The word was baboon
Details of the Program
The program should match the output described above as it will be tested automatically. A sample exectuble program will also be available for you to run.
如果要细看到以下网址:
http://teaching.ics.mq.edu.au/units/comp115/assignments/a3.html