EasyManua.ls Logo

Radio Shack TRS-80 - Page 158

Radio Shack TRS-80
236 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
Loading...
where
the triangle
looks
like this:
A
=
3
B
=
4
Okay.
That's not too
grim.
So
let's
write
a program to
find the value of L,
when A
=
3
and
B
=
4. If we
had
the built-in
square
root function
(which we
don't),
our
program
might
look
like this
:
10
REM
*
SQUARE
ROOT
SOLUTION WITH
SUBROUTINE
*
20 IN.
"THE LENGTH OF
SIDE
A
=
";A
30 IN. "THE LENGTH
OF SIDE
B
=
";B
40 L
=
SQR(A*A
+
B*B)
50
P. "A",
"B"
,
"L"
60 P. A ,B ,L
Now type
in the
program carefully
and
RUN.
Caarash!
The
WHAT?
40
L=S?QR(A*A
+
B*B)
tells us the
Computer does
not
recognize SQR.
That means
we'll
have to
call
up
the SQR
subroutine
from Appendix A to
make a
workable
program.
See the
list
at
the end of
this Chapter to
determine which
functions are
available as sub-
routines
in Appendix A.
Turn to
page 216 of
Appendix
A
and
find the
Square Root
Subroutine.
There
are three
important
things to look for
when checking
out
any
subroutine:
1.
What
is the input
variable?
2.
What
is
the
output variable?
156
Whenever you
come
across a
program with
aft
intrinsic function you
don't
have,
you'll
go
";t&roagh this
same
procedure.
First
type
in
the
§|
subroutine,
then make
a
few minor changes
in
ed.to#ei^t^;-
:
:
:

Other manuals for Radio Shack TRS-80

Related product manuals