| Chapter 5 A Guessing Game. |
||||||||||
| Hooray ! Your teacher is teaching you something useful! A game! Don't keep your hopes up high. This is just the beginning! |
||||||||||
| Check out this line of code. | ||||||||||
| x = INT(RND * 5) + 1 | ||||||||||
| It selects a number between 1 and 5 , storing it in x. We will use it in this program. |
||||||||||
| RANDOMIZE TIMER x = INT(RND * 10)+1 PRINT "I am thinking of a number between 1 and 10." INPUT "What is it?" , num IF num = x THEN GOTO win INPUT "You are wrong! Try again!", num IF num = x THEN GOTO win INPUT "I'll give you on last chance.What is it ?", num IF num = x THEN GOTO win PRINT "You lose !" PRINT "The answer was", x win: PRINT "Unfortunately, you won!" PRINT "I am a spoilt sport so," PRINT "Say goodbye to your computer !" END |
||||||||||