Question: Write a program named Lab 1 1 B . Randomly generate an integer between 0 and 1 0 0 and ask the user to enter
Write a program named LabB
Randomly generate an integer between and and ask the user to enter a guess.
Compute the absolute value of the difference between the user guess and the secret number.
Print the absolute value of the difference and
if it is print Warm
otherwise, print Cold
Keep asking for a guess and printing Warm or Cold until the user guesses the right number.
Use a flagcontrolled while loop to accomplish this task.
To generate a random number:
Add #include & #include with your other include statements
Declare an int variable named randomNum to hold the random number
Add this code after your variable declarations:
srandtime;
randomNum rand;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
