Download Print this page

VTech PreComputer 2000 Manual page 30

Advertisement

Here's another one
.
Type:
NEW
10 INPUT "GIVE ME A NUMBER";A
20 INPUT "AND ANOTHER";B
30 PRINT "ADD, SUBTRACT, MULTIPLY OR DIVIDE"
40 PRINT "TYPE IN THE FIRST LETTER OF THE"
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=NB
:
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 things in it that are worthwhile
to know about. Line 70 contains an INPUT statement without the prompt string.
Lines 100 through 130 contain two statements for the thing to do 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.
29

Advertisement

loading
Need help?

Need help?

Do you have a question about the PreComputer 2000 and is the answer not in the manual?