Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 5 Write a guessing game where the user should guess a secret number, from 0 to X. After every guess the program tells the
Question 5 Write a guessing game where the user should guess a secret number, from 0 to X. After every guess the program tells the user whether their number was too large or too small until the user finds the right number. Write a function for your implementation, this function need to receive the maximum number to guess. In the end, this function must return the value found by the user, and present it in the main function. The number of tries needed should be printed - you can do this inside the function, return through the function or not, is up to you. Hint (you can use another way to have rand numbers -look for srand in cplusplus reference, you should initiate a seed for real random numbers) vl-randd) % 100; //vl in the range 0 to 99
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