NOTE |
Use of conditional branching within a loop. This program is a guessing game. |
HEADING '' HISSCORE=0; YOURSCORE=0 10 PAGE PRINT 'GUESS NUMBERS BETWEEN 0 AND 100' PRINT 'MACHINE: ':HISSCORE:' ':'YOU:':YOUR SCORE NUM=RND(101) FOR I=1 TO 6 PRINT 'GUESS ':I:' ': INPUT GUESS IF GUESS=NUM THEN PRINT 'CONGRATULATIONS, YOU WON!' YOURSCORE=YOURSCORE+1 GOTO 60 END IF GUESS<NUM THEN PRINT 'HIGHER' IF GUESS>NUM THEN PRINT 'LOWER' NEXT I PRINT 'YOU LOST YOU DUMMY, YOUR NUMBER WAS':NUM HISSCORE=HISSCORE+1 60 PRINT PRINT 'AGAIN?': INPUT X IF X = 'NO' THEN STOP GOTO 10 END |
See Also