For each of the problems below state the purpose in your own words, specify inpu
ID: 3886941 • Letter: F
Question
For each of the problems below state the purpose in your own words, specify input that is needed, expected output, and the step by step process that will obtain the output from the input (the algorithm). In addition to these 4 items also specify test data that can be used to all the scenarios described for each problem. DONT WRITE ACTUAL CODE (C++)
Problem 2: Write a process that will generate a random whole number between 1 and 1000 inclusive. Then allow the user to make a guess. When the user’s guess matches the random number output a message stating that the user guessed the number. When the user’s guess does not match the random number, output a message that user’s guess is too low or too high and prompt the user to enter a new guess until the guess matches the random number.
Program
Explanation / Answer
//a process that will generate a random whole number
// between 1 and 1000 inclusive. Then allow the user
//to make a guess. When the user’s guess matches the
//random number output a message stating that the user
// guessed the number. When the user’s guess does not
// match the random number, output a message that user’s
// guess is too low or too high and prompt the user to
//enter a new guess until the guess matches the random
//number.Program
main function
int guess,rand_num //declaration
print kindly enter your guess;
calling a function that will generate random int and it is predefine in libraries
rand_num=random(1000)
then for checking the condition that the guess is equal to rand_num use conditional statements
as funcion
check(rand_num)
print kindly enter your guess;
if guess==rand_num
return you guessed right number
else
return you guessed wrong number
if mod(rand_num-guess) > 250
print guess is too low or too high so please enter a new guess
check(rand_num)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.