5 CLS
6 INPUT "What is your name";NAME$
10 INPUT "WHAT IS YOUR SALARY";SALARY
20 IF SALARY < 10000 THEN GOT0 30 ELSE 40
30 PRINT "ASK FOR A PAY RISE": END
40 PRINT "ASK FOR A BIGGER CAR"
50 IF SALARY >30000 THEN PRINT
"and get a good accountant"
60 IF SALARY >25000 THEN PRINT
“. . . . and lend me a fiver ";NAME$
61 DAILY.RATE=SALARY/365:
PRINT "that's “;DAILY.RATE;" a day"
62 INTEGER.RATE%=DAILY.RATE:PRINT
"or “;INTEGER.RATE%;" if you are not
worried about the odd pence”
70 FOR n=1 to 5000: NEXT n:GOTO 5
run
And run again.
Note that you must remember to continue to use the type marker % since it is possible to have a real
variable with the same name as the integer variable, the difference being identified by the % symbol.
Also see how the computer display ‘wraps’ lines that are too long to fit on a single line (it happens in
all three modes).
Use MODE 2 for writing long programs, since it’s much easier to read programs that are not for ever
running over the ends of the lines.
To get to MODE 2,type
MODE 2
And to produce black on white display that is easier to read on the CTM640, enter the following
three direct commands:
INK 1,0
INK 0,13
BORDER 13
Now LIST again.
4.8 Display formatting
Part of the evolution of your program is the process of tidying it up from time to time. The first thing
we can do is renumber all the lines to multiples of 10 by using the RENUM command. At the Ready
prompt, type:
RENUM
And then LIST again: