EasyManua.ls Logo

Radio Shack TRS-80 - Appendix 0; Sample Programs

Radio Shack TRS-80
169 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...
Computer
Graphics
Operation
Manual
-----------TRS·BO
®
----------
Appendix
D/
Sample
Programs
BASICG
l~
,
2~
,
Pie
Graph
Program
("pECANPIE/GRA")
3~
,
4~
,
Object
5~'
The
object
of
this
program
is
to
draw
a
pie
graph
of
the
6~'
expenses
for
a
given
month
of
eight
departments
of
a
company,
7~'
along
with
the
numerical
value
of
each
pie
section
8~'
representation.
9~
,
l~~
,
ll~
,
Running
the
program
l2~'
The
month
and
the
amounts
spent
by
each
department
are
input,
l3~'
and
the
program
takes
over
from
there.
l4~
,
l5~
,
Special
features
~
l6~'
The
amounts
spent
by
each
account
as
well
as
the
total
l7~'
amount
spent
are
stored
in
strings.
The
program
will
18~'
standardize
each
string
so
that
it
is
9
characters
long
19~'
and
includes
two
characters
to
the
right
of
the
decimal
2~~'
point.
This
allows
for
input
of
variable
length
and
an
2l~'
optional
decimal
point.
22~
,
23~'
The
various
coordinates
used
in
the
program
are
found
24~'
based
on
the
following
equations:
25~
,
26~
, x = r *
cos
(theta)
27~
, Y = r *
sin(theta)
28~
,
29~'
where
x
and
yare
the
coordinates,
r
is
the
radius,
and
theta
3~~'
is
the
angle.
(Note:
The
y-coordinates
are
always
multiplied
3l~'
by
~.5.
This
is
because
the
y
pixels
are
twice
the
size
of
the
32~'
x
pixels.)
33~
,
34~'
If
an
angle
theta
is
generated
by
a
percent
less
than
1%,
the
35~'
section
is
not
graphed,
and
the
next
theta
is
calculated.
36~
I
However,
the
number
will
still
be
listed
under
the
key.
37~
,
38~
,
Variables
39~'
ACCT$(i)
Description
of
the
account
4~~'
BUD$(i) Amount
spent
by
the
account
----------ltadI8Ihaell----------
-127-

Other manuals for Radio Shack TRS-80

Related product manuals