Question
Write a C++ program that simulates a simple game you can play with a friend. Your friend thinks up a random 3-digit number with no
Write a C++ program that simulates a simple game you can play with a friend. Your friend thinks up a random 3-digit number with no repeating digits, and you try to guess what the number is. After each guess, your friend gives you clues on how close your guess was.
If the friend tells you B, that means that none of the three digits you guessed is in the secret number.
If your friend tells you P, then one of the digits is in the secret number, but your guess has the digit in the wrong place.
If your friend tells you F, then your guess has a correct digit in the correct place.
Of course, even if you get a P or F clue, you still don't know which digit in your guess is the correct one.
You can also get multiple clues after each guess. Say the secret number is 456, and your guess is 546. The clue you get from your friend would be F P P because one digit is correct and in the correct place (the digit 6), and two digits are in the secret number but in the wrong place (the digits 4 and 5).
Note : The program must be running until the user decides to terminated it by entering no or No
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