
Reset the computer to clear the memory. (CTRL] [SHIFT] and [ESC] keys). If you had wanted an
input made up of any characters (letters or letters and numbers), the dollar sign $ must be used at
the end of the variable.
Type in the following program: (Note that in line 20 you must put a space after the o in hello and
before the m in my).
1 0 i n p u t " w h a t i s y o u r n a m e " ; n a m e $ [ E N T E R ]
2 0 p r i n t " h e l l o " ; n a m e $ " m y n a m e i s A r n o l d "
[ENTER]
run [ENTER]
On the screen you will see:
what is your name?
Type in your name then
[ENTER]
If your name was Fred you will see on the screen:
h e l l o F r e d m y n a m e i s A r n o l d
(As a point of interest, Arnold was the codename for the AMSTRAD CPC464 during its
development.)
Although we used name$ in the above for the name string variable, we could have just as easily used
a letter, for example a$. Now we will combine the above 2 examples into one program.
Reset the computer by pressing [CTRL] [SHIFT] and [ESC]. Type in the following:
5 cls [ENTER]
1 0 input "what is your n a m e " ; a $ [ENTER]
2 0 i n p u t " w h a t i s y o u r a g e " ; b [ E N T E R ]
3 0 p r i n t " I m u s t m u s t s a y " ; a $ " y o u d o n t l o o k " ;
b " y e a r s o l d " [ENTER]
run [ENTER]
In this program we have used 2 variables, a$ for the name and b for the age.
On the screen you will see:
w h a t i s your name?
Now type in your name (e.g. Fred) then [ENTER]. You will then be asked:
what is your age?
Now type in your age (e.g.18, then [ENTER]. If your name were Fred and your age 18, on the screen
you will see:
I
m u s t s a y F r e d y o u d o n t l o o k 1 8 y e a r s
Содержание CPC464
Страница 1: ......
Страница 32: ...or you can type 3e1 1e1 ENTER 300 2 3000x1000 Type 3e3 1e3 ENTER 3000000 3 3000x0 001 Type 3e3 1e 3 ENTER 3 ...
Страница 102: ...PRINT 10 AND 12 Results in 8 PRINT 10 AND 1000 Results in 8 again ...
Страница 118: ...TO DO DRAW THIS PAGE ...
Страница 219: ...actual value may be made to vary during the execution of a program ...
Страница 240: ...Text and WINDOW planner Mode 2 80 Columns ...
Страница 241: ......
Страница 245: ...Sound envelope Music planner sheet ...