Input - AMSTRAD CPC464 User Manual

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

Advertisement

Type in
cls
[ENTER]
to clear the screen.
To see the word hello printed continuously on each line, one next to another filling the whole of the
screen, type in the previous program but with a semi-colon ; after the quotation marks "
Type:
1 0 p r i n t " h e l l o " ;
2 0 g o t o 1 0 [ E N T E R ]
r u n [ E N T E R ]
Note that the semicolon immediately following the
tells the computer to print the next
[ENTER]
character immediately following the previous one. Escape from this program by pressing
[ESC]
twice. Now type in line 10 again, but this time use a comma , instead of a semi-colon ;
1 0 p r i n t " h e l l o " , [ E N T E R ]
r u n [ E N T E R ]
You will now see that the comma , tells the computer to print the next character (or group of
characters) 13 columns away from the beginning of the first group of characters. This feature is
useful for displaying information in separate columns.
Note, however, that if the number of characters in a group exceeds 12, the next character will be
displaced forward by another 13 columns.
Again, to escape from this program press [ESC] twice. To clear the computer' s memory completely,
hold down the
and [ESC] keys in that order, and the computer will reset.
[SHlFT] [CTRL]

INPUT

This command is used to let the computer know that it is expecting something to be typed in, for
example, the answer to a question. Type,the following:
1 0 i n p u t " w h a t i s y o u r a g e " ; a g e [ E N T E R ]
2 0 p r i n t " y o u l o o k y o u n g e r t h a n " ; a g e " y e a r s
o l d . " [ E N T E R ]
r u n [ E N T E R ]
On the screen you will see:
w h a t i s y o u r a ge?
Type in your age then [ENTER] If your age was 18, the screen would then show: you Look
younger than 18 years old.
This example shows the use of the input command and a number variable. The word age was put
into the memory at the end of line 10 so that the computer would associate the word age with
whatever numbers were typed in and would print these numbers where the word age is on line 20.
Although we used the expression age in the above for the age variable, we could have just as easily
used a letter, for example b.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents