Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need it in c++ and to be used in codeblocks For this program you are going to make a simple number guessing game. Players
I need it in c++ and to be used in codeblocks
For this program you are going to make a simple number guessing game. Players will try to guess three integers from clues that you provide. For each number you should tell players the result of taking that number and dividing it by a particular value. You should also tell players what they get when they take the modulus of the number by the same value. This should be enough information for players to determine the number. Once you give players the clues, ask them for a guess, then tell them whether they got it right or not. If they guessed incorrectly, you should tell them the right number. At the end of the round, you should tell players how many they got correct. You should then ask players if they want to play again, and if they do they should be allowed to try another time.
Sample Output:
Sample output of such a program is shown here (with user input in bold):
X/5 is: 8
X%5 is: 3
What is X?: 43
You are correct
X/7 is: 11
X%7 is: 1
What is X?: 89
You got it wrong!
The number was: 78
X/3 is: 7
X%3 is: 0
What is X?: 21
You are correct
YOU GOT 2 CORRECT!
Do you want to play again (y/n)? n
Good bye!
Your program does not have to look exactly like this one. Remember, if users indicate that they do want to play again they should be given another chance to guess the numbers. The user should be able to play again as many times as they want without the program ending.
Requirements:
You should use appropriate commenting and indentation in your code, as discussed in class. Make sure your name, e-mail, and a description of the file are in comments at the top of your code. If this is not done, expect significant points to be deducted from your grade.
The game would be more interesting if the program changed the number for every round it was played. To do this, you need to have the computer randomly choose values for X before each round of the game. If you missed a lab activity and would like to make it up, then you need to do the following to receive credit for the missed lab:
1. Modify the program so that three random numbers are chosen before each round of the game. The numbers should be different every time the game is played.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started