Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions