EasyManua.ls Logo

AMSTRAD CPC464 - Page 93

AMSTRAD CPC464
249 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
10 CLS
20 INPUT "What is your name";NAME$
30 INPUT "WHAT IS YOUR SALARY";SALARY
40 IF SALARY < 10000 THEN GOT0 50 ELSE 60
50 PRINT "ASK FOR A PAY RISE": END
60 PRINT "ASK FOR A BIGGER CAR"
70 IF SALARY >30000 THEN PRINT
"and get a good accountant"
80 IF SALARY >25000 THEN PRINT
“. . . . and lend me a fiver ";NAME$
90 DAILY.RATE=SALARY/365:
PRINT "that's “;DAILY.RATE;" a day"
100 INTEGER.RATE%=DAILY.RATE:PRINT
"or “;INTEGER.RATE%;" if you are not
worried about the odd pence
110 FOR n=1 to 5000: NEXT n:GOTO 10
run
All the line numbers have been rounded up - including those referred to within the body of the
program. It wouldnt be much to you use if BASIC didnt keep track of all the lines numbers and
update them all simultaneously.
Now well tidy up the display on the screen - and to do this, first disable the loop on line 110, by
turning the line from a command into a REMark:
10 CLS
20 INPUT "What is your name";NAME$
30 INPUT "WHAT IS YOUR SALARY";SALARY
40 IF SALARY < 10000 THEN GOT0 50 ELSE 60
50 PRINT "ASK FOR A PAY RISE": END
60 PRINT "ASK FOR A BIGGER CAR"
70 IF SALARY >30000 THEN PRINT
"and get a good accountant"
80 IF SALARY >25000 THEN PRINT
“. . . . and lend me a fiver ";NAME$
90 DAILY.RATE=SALARY/365:
PRINT "that's “;DAILY.RATE;" a day"
100 INTEGER.RATE%=DAILY.RATE:PRINT
"or “;INTEGER.RATE%;" if you are not
worried about the odd pence
110 REM FOR n=1 to 5000: NEXT n:GOTO 10
run
Inserting REM at the beginning of the line causes the remainder to be bypassed by BASIC, which
then ends the program and returns to the Ready prompt leaving the screen display in view. Now
type in:
15 mode 1
Line 15 will firstly fix the mode of the display so that regardless of what mode was active when you
asked the program to run, line 15 will set it to mode 1. The MODE command automatically performs
a CLS - so line 10 is now redundant, but well leave it there anyway.

Table of Contents

Other manuals for AMSTRAD CPC464

Related product manuals