EasyManua.ls Logo

Sharp MZ-700 - Page 74

Sharp MZ-700
213 pages
Print Icon
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...
Examples
of
use
of
the built-in funcions
(Example 1)
Let's
try
solving the various elements
of
a triangle
with
a BASIC program.
Angle A
of
the triangle shown
in
the
figure
at
right
is
30°,
angle B
is
a right angle, and side CA has a length
of
12. The
following program finds all angles
of
the triangle, the
length
of
its sides, and its
total
area.
1 0
A=3
0
:B=9
0
:CA=12
2 0
AB=CA
::K
COS
CA
::K
PA
I C1 )/
180
)
3 0
BC=CA
::K
S
IN
CA
::K
PA
I C1 )/ 1
80
)
4 0
S=AB
::K
BC
/ 2
5 0
C=18
0
-A-B
6 0
PRINT
"
AB=
"-
;AB.
"
BC=
"
;BC
. "
CA=
" ;
CA
7 0
PRINT
"AREAS=
";
S
8 0
PRINT
"
A=
" ; A . "
B=
" ;
B.
"
C=
" ; C
9 0
END
(Example
2)
Now
let's change line
50
of
the
program
to
use ATN,
the
function for finding the arctangent
of
a
number,
to
fme angle C from sides
AB
and
BC.
1 0
A=3
0:
B=9
0:C
A=12
2 0
AB=CA
::K
COS
CA::K
PA
I C1 )/
18
0)
3 0
BC=
CA::K S
IN
CA::K
PA
I C1 )/ 1 8
0)
4 0
S=AB
::K
BC
/ 2
5 0
C=ATN
C
AB
/
BC
) * 1 8 0 /
PA
I C1 )
6 0
PRINT
7 0
PRINT
8 0
PRINT
9 0
END
"
AB=
"
;AB.
" B C = "
;BC.
"
CA=
" ;
CA
"
ARE
A
S=
" ; S
"
A=
" ;
A.
"
B=
" ;
B.
"
C=
" ; C
RND function
Format
Function
RND
(X)
X
..
Numeric expression
The
RND function returns a pseudo-random
number
in the range from 0.00000001
to
0.99999999.
When X is grea
ter
than
0,
the random
number
returned
is
the one which follows
that
previously generated
by
the
BASIC interpreter in a given pseudo-random
number
series.
When
X~
0,
the
BASIC
Interpreter
's pseudo-random
number
generator is reinitia-
lized
to
start a new series, and
the
pseudo-random
number
returned is the first one
in
that
series. Reinitialization
of
the pseudo-random
number
series in this
manner
can be used
to
allow simulations based on random numbers
to
be reproduced.
72----
--------------
--
--------------
--
------------------------------------

Other manuals for Sharp MZ-700

Related product manuals