Question: Write a number-guessing game in which the computer selects a random number in the range of 0 to 100, and users get a maximum of

Write a number-guessing game in which the computer selects a random number in the range of 0 to 100, and users get a maximum of 20 attempts to guess it. At the end of each game, users should be told weather they won or lost, and then be asked whether they want to play again. When the user quits, the program should output the total number of wins and losses. To make the game more interesting, the program should vary the wording of the messages that it outputs for winning, for losing, and for asking for another game. Create as many as 10 different messages for each of these cases, and use random numbers to choose among them. See Appendix C.7 for information on the C++ random-number generator functions. This application should provide a good opportunity for you to use a Do-While statement and switch statements. Use functional decomposition to solve the problem, write your C++ code using good style and documenting comments, and have fun thinking up some messages that will surprise the user. In Appendix use rand and srand in program.

Your program should use meaningful variable names, proper indentation, and appropriate comments. Points will be deducted for failing to properly format your program. Do not use any code not covered in chapters 1 through 7.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!