Write a program that generates a random number and asks the user to guess what t
ID: 3527776 • Letter: W
Question
Write a program that generates a random number and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high, try again." if the user's guess is lower than the random number, the program should display "Too low, try again." The program should use a loop that repeats until the user correctly guesses the random number. You shall also keep a count of the number of guesses that the user makes. When the user correctly guesses the random number, the program should display "congratulations you figured out my number".Explanation / Answer
#include #include using namespace std; int main () { int random; int num; int max; int min; int outofrange; int rightguess; rightguess = 1; outofrange = 0; max = 100; min = 0; srand(time(NULL)); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.