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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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 40 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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply