Question: Write a C++ program that assigns a random secret integer between 1 and 100 to a variable and then prompts two players to guess the

 Write a C++ program that assigns a random secret integer between

Write a C++ program that assigns a random secret integer between 1 and 100 to a variable and then prompts two players to guess the number. The player that wins is the first one that finds the random secret number in fewer attempts. A player has no more than five tries to guess the secret value. Define a variable diff to equal the absolute value of (secret value - guess). If diff is 0 then output a message, "You found it!" as well as the total number of attempts. If diff does not equal 0 then: If diff is greater than or equal to 50, the program should output a message indicating that the guess is very high (if guess is greater than the secret value) or very low (if guess is less than the secret value) If diff is greater than or equal to 30 and less than 50, the program should output a message indicating the guess is high (if guess is greater than the secret value) or low (if guess is less than the secret value) If diff is greater than or equal to 15 and less than 30, the program outputs a message indicating that the guess is moderately high (if guess is greater than the secret value) or moderately low (if guess is less than the secret value) If diff is greater than 0 and less than 15, the program outputs a message indicating that the guess is somewhat high (if guess is greater than the secret value) or somewhat low (if guess is less than the secret value). Modify the attached source code. Make sure to use meaningful variable names and proper line spacing. Include as comments in your program your name and a brief description of the program. Turn in a printout of your source code. Upload a copy of your source code to Sakai (Assignments: Program-3). Name your source file prog3.cpp

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!