Page 1 of 1

Use the function you defined in Part 1 to write a program for "Guees the Number" game. In this game the user is to guess

Posted: Mon Jun 06, 2022 2:11 pm
by answerhappygod
Use The Function You Defined In Part 1 To Write A Program For Guees The Number Game In This Game The User Is To Guess 1
Use The Function You Defined In Part 1 To Write A Program For Guees The Number Game In This Game The User Is To Guess 1 (60.31 KiB) Viewed 27 times
Use the function you defined in Part 1 to write a program for "Guees the Number" game. In this game the user is to guess a random number in the range [1, 100] generated by the computer. Here are the steps that the program takes: 1. The program calls the function declared in Part 1 to generate a random integer in the range [1, 100]. 2. The program then asks the user to guess the number generated in the previous step. 3. If the user enters the correct number, the program alerts "You won!" and terminates. 4. If the number entered by the user is not in the range [1, 100], the program alerts an error message and goes to Step 2. 5. If the number entered by the user is less than the random number generated in Step 1, the program displays "Enter a larger value" and goes to Step 2. 6. If the number entered by the user is greater than the random number generated in Step 1, the program displays "Enter a smaller value" and goes to Step 2. The program continues until the user guesses the number correctly