Commodore VIC-20 User Manual page 100

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

Advertisement

50!FA$ = "C"THEN PRINT "STEAK AND EGGS"
60 GOTO 10
RUN
When this program has been typed in and RUN, it will wait lor
the operator to hit any key. If the key was the letter A, the
words, CHICKEN SOUP appear on the screen. The letter B
makes the word SPAGHETTI appear, and the word C makes
the words STEAK AND EGGS show up. You now have the VIC
typing whole words with only 1 keystroke!
Now you will get the longest program so far, a practical exam
ple of the GET and PRINT statements used to give you a com
puterized recipe fife. Don't be alarmed by the size of this pro
gram. It uses mostfy simple PRINT statements but the lesson
here is how the A$ variable is used to starcd for several whole
phrases, and how the GET command
10 PRINT" |^^2 KTH PLEASE PICK A CHOICE"
20 PRINT 1LFROM THE MENU:11
Try typing
your own
recipes! All you
have to do is change
the titles and recipe
information...
30 PRINT
40 PRINT "A..,CHICKEN SOUP'+
50 PRINT "B...SPAGHETTI"
60 PRINT "C...STEAK & EGGS"
200 GET AS:IFA$ = ""THEN 200
210 IF A$ = "A" THEN 500
220 IF A$ = llBT1THEN 700
230 IF A$ = "Cf! THEN 900
490 GOTO 200
500 PRINT ■ I j£j (r I Hftfif MIKE'S CHICKEN SOUP"
510 PRINT
520 PRINT 'TAKE 1 CHICKEN. KILL"
90
This means
if you hit
anything else,
nothing happens
and the program
keeps waiting for
you to type
A, B or C.
<
<
c
<
I
c
c
I
<
c
c
c
c
c
(
I
c
<
c
(
c
c
c
c
c
c
I

Advertisement

Table of Contents
loading

Table of Contents