A student wrote the following code for a guessing game.
Line 1: secretNumber ← RANDOM (1, 100)
Line 2: win ← false
Line 3: REPEAT UNTIL (win)
Line 4: {
Line 5: DISPLAY ("Guess a number.")
Line 6: guess ← INPUT ()
Line 7: IF (guess = secretNumber)
Line 8: {
Line 9: DISPLAY ("You got it right!")
Line 10: }
Line 11: ELSE
Line 12: {
Line 13: IF (guess > secretNumber)
Line 14: {
Line 15: DISPLAY ("Your guess is too high.")
Line 16: }
Line 17: ELSE
Line 18: {
Line 19: DISPLAY ("Your guess is too low.")
Line 20: }
Line 21: }
Line 22: }
While debugging the code, the student realizes that the loop never terminates. The student plans to insert the
instruction win←true somewhere in the code. Where could win←true be inserted so that the code segment works as intended?