Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF (EN)

200 Associated keywords READ , RESTORE Demonstration program 10 REM geography quiz 20 DIM city$(5) 30 DIM country$(5) 40 FOR x=1 TO 5 50 READ city$(x) 60 READ country$(x) 70 NEXT x 80 right=0 110 FOR x=1 TO 10 120 r=RND(5) 130 PRINT "What city is the capital" 140 PRINT "of "; country$(r) 150 INPUT answer$ 160 IF answer$=city$(r) THEN PROCyes ELSE PROCno 170 NEXT x 180 PRINT "You got ";right; 190 PRINT " correct out of 10" 200 END 500 DATA Paris, France, Reykjavik 505 DATA Iceland 510 DATA Moscow, Soviet Union 520 DATA Athens, Greece 530 DATA Spitzbergen, Spitzbergen 600 DEF PROCyes 610 PRINT "Well done!" 620 right=right+1 630 ENDPROC 700 DEF PROCno 710 PRINT "No, the capital of 720 PRINT country$(r);" is ";city$(r) 730 ENDPROC Line 10 is just a REM ark which the computer ignores.

Lines 20 and 30 tell the computer that we are going to use two string arrays – one to store the names of the five cities and the other to store the names of the five countries. See chapter 21 for an explanation of arrays. Line 40 sets up a FOR...NEXT loop that will go around five times.