求助!

tanchen25 tanchen25 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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
...全文
评论 1
收藏 已收藏
分享
返回顶部
tanchen25
VC/MFC 16,550 成员 421,606 内容