Here comes a brief program to demonstrate these operators, based on subject very dear to our
hearts. If you are not already looking at the switch on screen message:
Amstrad 64k Microcomputer (v1)
c 1 9 8 4 A m s t r a d C o n s u m e r E l e c t r o n i c s
a n d L o c o m o t i v e S o f t w a r e L t d .
BASIC 1.0
Ready
. . ..then press the
[CTRL] [SHIFT]
and
[ESC]
keys, holding them down simultaneously, and the
computer will reset to the above message. Now proceed and type in the following (editing
instructions are given in 1.2.7):
1 0 I N P U T " W H A T I S Y O U R S A L A R Y " ; S A L A R Y
2 0 I F S A L A R Y < 1 0 0 0 0 T H E N G O T 0 3 0 E L S E 4 0
3 0 P R I N T " A S K F O R A P A Y R I S E " : E N D
4 0 P R I N T " A S K F O R A B I G G E R C A R "
Run this small program by typing:
RUN
and the obligatory
[ENTER].
The computer asks you a question:
WHAT IS YOUR SALARY?
(Note how the computer automatically adds the question mark when it wants you to respond with
an input of data). Answer the question using only numbers – not letters, currency signs or commas,
and enter your answer with the
[ENTER]
key.
Add line 5 below by simply typing after the end of the above operation, when the Ready prompt
reappears:
5 CLS
RUN again to wipe the screen. If your first answer was less than 10000, make this reply more than
10000, and you will see the difference. Now extend the original program by adding line 50 below:
5 CLS
1 0 I N P U T " W H A T I S Y O U R S A L A R Y " ; S A L A R Y
2 0 I F S A L A R Y < 1 0 0 0 0 T H E N G O T 0 3 0 E L S E 4 0
3 0 P R I N T " A S K F O R A P A Y R I S E " : E N D
4 0 P R I N T " A S K F O R A B I G G E R CAR"
5 0 I F S A L A R Y > 3 0 0 0 0 T H E N P R I N T " a n d
g e t a g o o d a c c o u n t a n t "
run
The END at line 30 stops the program and returns to the prompt. Since there’s no end on line 40, the
program proceeds to see if the SALARY variable is greater than 30000 - in which case the program
responds with yet more sound advice!
Summary of Contents for CPC464
Page 1: ......
Page 102: ...PRINT 10 AND 12 Results in 8 PRINT 10 AND 1000 Results in 8 again ...
Page 118: ...TO DO DRAW THIS PAGE ...
Page 219: ...actual value may be made to vary during the execution of a program ...
Page 240: ...Text and WINDOW planner Mode 2 80 Columns ...
Page 241: ......