21.7k views
1 vote
Draw a structured flowchart or write pseudocode that describes the process of guessing a number between 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 a fellow student try to guess it by following your instructions.

1 Answer

4 votes

In pseudocode

num2guess = random(1,100)

pnum = 0

while (pnum != num2guess) {

pnum = ask_player("What number I'm thinking?")

if (pnum > num2guess) {

print("Too high.")

} else if (pnum < num2guess) {

print("Too low.")

}

}

print("Good job!")

User Ajxs
by
7.4k points