73.7k views
3 votes
write a structured pseudocode that describes the process of guessing a number 1 and 100. After each guess, the player is told that the guess is too high or too low. The process continues until the player guesses the correct number. Pick a number and have follow student try guessing it by following your instructions.

1 Answer

7 votes

Here is a structured pseudocode for the process of guessing a number between 1 and 100:

Generate a random number between 1 and 100 and store it as the correct number.

Prompt the player to enter a guess.

Read the player's guess.

If the guess is equal to the correct number, display a congratulatory message and end the game.

If the guess is too high, display a message indicating that the guess is too high and go back to step 2.

If the guess is too low, display a message indicating that the guess is too low and go back to step 2.

Here's an example run of the game with the correct number being 67:

1. Generated number is 67.

2. Please enter your guess between 1 and 100.

3. 50

4. Too low. Please try again.

2. Please enter your guess between 1 and 100.

3. 80

5. Too high. Please try again.

2. Please enter your guess between 1 and 100.

3. 67

4. Congratulations! You guessed the correct number.

Have fun trying to guess the number!

User Francis Cugler
by
7.7k points