EasyManuals Logo

HP HP-67 User Manual

HP HP-67
364 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #208 background imageLoading...
Page #208 background image
204
Subroutines
Routine-Subroutine
Usage
Subroutines
give
you
extreme
versatility
in
programming.
A
sub-
routine
can
contain
a loop,
or
it
can
be
executed
as
part
of
a
loop.
Another
common
and
space-saving
trick
is
to
use
the
same
routine
both
as
a
subroutine
and
as
part
of
the
main
program.
Example:
The
program below
simu-
lates
the
throwing
of
a
pair
of
dice,
pausing
to
display
first
the
value
of
one
die
(an
integer
from
1
to 6)
and
then
pausing
to
display
the
value
of
the
second
die
(another
integer
from
1
to
6).
Finally
the
values
of
the
two
dice
are
added
together
to
give
the
total
value.
The
‘‘heart’”
of
the
program
is
a
random
number
generator
(actually
a
pseudo
random
number
generator)
that
is
executed
first
as
a
sub-
routine
and
then
as
part
of
the
main
program.
When
you
key
in
a
first
number,
called
a
‘‘seed’’,
and
press
3,
the
digit
for
the
first
die
is
generated
and
displayed
using
the
f#
(€]
routine
as
a subroutine.
Then
the
digit
for
the
second
die
is
generated
using
the
same
routine
as
part
of
the
main
program.
To
key
in
the
program:
Slide
the
Program
Mode
switch
wrem
[[[[Illrun
to
W/PRGM.
Press
Display
fooo
(00157
31
—s5-00]
(€)
executed
first
as
subroutine.
oes
%“>a§
o
STO
a
]
©

Table of Contents

Other manuals for HP HP-67

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP HP-67 and is the answer not in the manual?

HP HP-67 Specifications

General IconGeneral
BrandHP
ModelHP-67
CategoryCalculator
LanguageEnglish

Related product manuals