Random Number Guessing Game Write a program that generates a random number and a
ID: 671412 • Letter: R
Question
Random Number Guessing Game
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.
i want c++ formate please.
Explanation / Answer
#include #include #include int main() { std::srand(std::time(0)); int lower, upper, guess; std::cout > lower; std::cout > upper; int random_number = lower + std::rand() % ((upper + 1) - lower); do { std::cout > guess; if (guess > random_number) std::coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.