AMSTRAD CPC464 User Manual page 25

Cpc464 colour personal computer 64k
Hide thumbs Also See for CPC464:
Table of Contents

Advertisement

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 " [ E N T E R ]
r u n [ E N T E R ]
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 c l s [ E N T E R ]
1 0 i n p u t " w h a t i s y o u r n a m e " ; a $ [ E N T E R ]
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 " [ E N T E R ]
r u n [ E N T E R ]
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 y o u r n a m e ?
Now type in your name (e.g. Fred) then [ENTER]. You will then be asked:
w h a t i s y o u r a g e ?
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:
must say Fred you dont look 18 years
I

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents