Page 1 of 1

Write a program which reads a secret number and then, a different user will try to guess the secret number by entering r

Posted: Tue Jul 12, 2022 8:40 am
by answerhappygod
Write A Program Which Reads A Secret Number And Then A Different User Will Try To Guess The Secret Number By Entering R 1
Write A Program Which Reads A Secret Number And Then A Different User Will Try To Guess The Secret Number By Entering R 1 (44.01 KiB) Viewed 42 times
C++
Write a program which reads a secret number and then, a different user will try to guess the secret number by entering random numbers. Your program will: 1. Read an integer positive value that will be considered as the secret number (secret_number). 2. Ask the other user to input an integer positive number (input_number), will compare it to the secret number and performs the following actions: a. If input number is greater than secret_number, then it will output the message: "too large". b. c. If input_number is less than secret_number, then it will output the message: "too small". If the user did not guess the secret number (too large or too small), then the program will go back to step 2 and performs actions a, b, and c repeatedly as long as the secret number is not guessed (input_number is not equal to secret_number). 3. If the user has guessed the secret number (input_number is equal to secret_number), then it will output the message: "Congrats" input_number "is the magic number." Output example: "CeramOwDrive Unvenity Of Houston Teaching CoCop Program NoProjecte Input the secret number (0):23 What's the secret number: 50 Too largel hat's the secret number:10 To small! hat's the secret number:25 Too largel hat's the secret number: 20 To small! What's the secret number:24 Too large! hat's the secret number:23 Congrats! 23 is the magic number. Process returned 0 (exe) execution time: 32.550 s Press any key to continue. x