Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

Explain Intermediate term financing in detail.

Answered: 1 week ago

Question

Types of cultural maps ?

Answered: 1 week ago

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

Define the term "Leasing"

Answered: 1 week ago