HP (Hewlett-Packard) 32SII Calculator User Manual


 
12–12 Simple Programming
File name 32sii-Manual-E-0424
Printed Date : 2003/4/24 Size : 17.7 x 25.2 cm
"R" is the variable's name,
"
?
" is the prompt for information, and
0.0000 is the current value stored in the variable.
Press
f
(run/stop) to resume the program. The value you keyed in then
writes over the contents of the X–register and is stored in the given variable. If
you have not changed the displayed value, then that value is retained in the
X–register.
The area–of–a–circle program with an INPUT instruction looks like this:




"!


º

π

º

!
To use the INPUT function in a program:
1. Decide which data values you will need, and assign them names.
(In the area–of–a–circle example, the only input needed is the radius,
which we can assign to R.)
2. In the beginning of the program, insert an INPUT instruction for each
variable whose value you will need. Later in the program, when you write
the part of the calculation that needs a given value, insert a
K
variable
instruction to bring that value back into the stack.
Since the INPUT instruction also leaves the value you just entered in the
X–register, you don't have to recall the variable at a later time — you
could INPUT it and use it when you need it. You might be able to save
some memory space this way. However, in a long program it is simpler to
just input all your data up front, and then recall individual variables as you
need them.
Remember also that the user of the program can do calculations while the
program is stopped, waiting for input. This can alter the contents of the
stack, which might affect the next calculation to be done by the program.