PROG
Reads two numbers and produces the sums.
PED
To learn how to make your program have nice prompts.
CONCEPTS
To retrieve a number with a prompt "ppp".
write('ppp ');
read(box_name);
SF
character string constant
'text'
Click here to view Unit 1.4 Pascal program.
We would also like to label the answers so the user knows what each number that the program spits out is for.
This is real simple. To lable a number to be read, we simply put in our program:
write('ppp ');
read(box_name);
The space between the ppp and the quote will cause a nice separation between the text and the number that the user types in. When the user types in the number wanted, the carriage return that the user types, will separate the prompt and the user input from the next item input or output.
The form 'text ' is a character string constant. There is another variable type called "string" which contains character strings. It is called "string." A character string
constant is to the string type what 123 is to an integer.