Commodore VIC-20 User Manual page 111

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

PROGRAM 5: Temperature Conversion
(Chapter 6)
10
20
30
40
50
INPUT
PRINT
PRINT
PRINT
GOTO
"DEGREES FAHRENHEIT"; F
F "DEGREES F."
"IS11 (F-32)*5/9 "DEGREES C,"
10
This introduces you to the INPUT statement which allows your
program to stop what it is doing and request necessary
information from the operator (the person who is RUNntng the
program).
Line 10 causes the message DEGREES FAHRENHEIT? to
appear on the screen. The words inside the quotes of an INPUT
statement work just like the PRINT statement. However, the
last word will always be followed by the question mark
character, and the program will wait at this point for more
information.
Line 20 prints the value of F, which is what was just typed in
(inputted). Line 30 prints the result of the conversion
calculation. In line 40, the word PRINT alone on a line causes a
blank line to appear on the screen.
line 50 makes the program go back to the beginning
and request more information to start again. The original
question will be asked again, and you can have more
temperatures converted. If you are finished, hold down the
STOP key and hit the RESTORE key. There is no other way to
tell this program you are through.
101

Advertisement

Table of Contents
loading

Table of Contents