求助!
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
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
...全文
相关推荐
晶体管测试仪电路
晶体管测试仪电路 基于单片机Atmega8/168/328 快速准确
晶体管测试仪PCB-电路方案
该套件具有标准的晶体管测试功能,用于确定晶体管的基极,电阻测量,电感,测量电容器(还测量ESR,Vloss)–检查石英(高达25mHz的测量,电压为32V。)
免费晶体管特性曲线测试仪电路图-综合文档
免费晶体管特性曲线测试仪电路图,晶体管特性曲线测试仪电路图……
M328晶体管测试仪
M328晶体管测试仪 测试二极管,三极管,MOSFET 等等
晶体管测试仪,具有NPN和PNP双极晶体管的自动检测功能-电路方案
来自mikrocontroller.net的著名晶体管测试器的小版本,具有NPN和PNP双极晶体管的自动检测功能, N和P沟道MOSFET,JFET,二极管,双二极管,N和P-IGBT,晶闸管,三端双向可控硅开关,电阻和电容器。


