Vtech PreComputer Power Pad Plus User Manual - Page 47

Print Arithmetic Operation You Want, Print Me To Do For You, Input R, Print You Made A Mistake,

Page 47 highlights

50 PRINT "ARITHMETIC OPERATION YOU WANT" 60 PRINT "ME TO DO FOR YOU" 70 INPUT R$ 100 IF R$="A" THEN C=A+B : GOTO 200 110 IF R$="S" THEN C=A-B : GOTO 200 120 IF R$="M" THEN C=A*B : GOTO 200 130 IF R$="D" THEN C=A/B : GOTO 200 140 PRINT "YOU MADE A MISTAKE" 150 PRINT "TRY AGAIN" 160 GOTO 30 200 PRINT "THE ANSWER IS ";C 300 END This is a long program but it has a lot of new information that is worthwhile to know. Line 70 contains an INPUT statement without the prompt string. Lines 100 through 130 contain two statements for the command when the condition is true. One is a LET statement without the word LET (C=A+B) and the other is a GOTO statement. Both of the statements are separated from each other by the colon ( : symbol). The GOTO statement tells the computer the number of the next statement to do. Line 140 is an error trap. It tells you that you have not followed instructions. You can experiment some more with this program and put in a decision to start the program all over again. If you change line 300 to be GOTO 10, the program runs continually. You can stop it by pressing the SHIFT and BREAK keys and resume it by typing in CONT and press ENTER. 43

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88

43
50
PRINT “ARITHMETIC OPERATION YOU WANT”
60
PRINT “ME TO DO FOR YOU”
70
INPUT R$
100
IF R$=“A” THEN C=A+B : GOTO 200
110
IF R$=“S” THEN C=A-B : GOTO 200
120
IF R$=“M” THEN C=A*B : GOTO 200
130
IF R$=“D” THEN C=A/B : GOTO 200
140
PRINT “YOU MADE A MISTAKE”
150
PRINT “TRY AGAIN”
160
GOTO 30
200
PRINT “THE ANSWER IS ”;C
300
END
This is a long program but it has a lot of new information that is worthwhile to know.
Line
70 contains an
INPUT
statement without the prompt string.
Lines 100 through 130 contain
two statements for the command when the condition is true.
One is a
LET
statement
without the word
LET
(C=A+B) and the other is a
GOTO
statement.
Both of the statements
are separated from each other by the colon ( : symbol).
The
GOTO
statement tells the
computer the number of the next statement to do.
Line 140 is an error trap.
It tells you
that you have not followed instructions.
You can experiment some more with this program and put in a decision to start the program
all over again.
If you change line 300 to be
GOTO
10, the program runs continually.
You can stop it
by pressing the
SHIFT
and
BREAK
keys and resume it by typing in
CONT
and press
ENTER
.