EasyManua.ls Logo

Radio Shack TRS-80

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...
There
it
is. All the data you can handle
(and
then some).
By using the up or down
arrow
key
to
temporarily halt
execution,
you can study the
data at every step
to understand
how the
program
works
(or doesn't
work).
Do it. Understand
this program
and all its little
lessons
completely.
When
you
are
satisfied, go
back
and
erase
out the
"flags".
You have
learned
quite enough for this Chapter.
EXERCISE
14-1:
Enter this
straightforward
little program for
finding
the area of a
circle.
(First type
NEW
-)
10 P
=
3. 14159
20 PRINT
"RADIUS",
"AREA"
30 PRINT
40
FDR
R=l
TO
10
50
A=P*R*R
60 PRINT R,A
70 NEXT R
Area equals
tt times the radius squared (that is,
the radius
times itself).
Then
RUN it to
make sure
it
works.
Pretty
routine
stuff
huh? Problem
is,
who
needs all those
little
numbers
to
the far
right
of
the
decimal
point.
Oh, you
do?
Well,
there's
one in
every crowd.
The
rest of us can
do
with-
out them. Without
giving any big hints, modify
the
resident
program to suppress all the
numbers to the right
of the decimal point.
EXERCISE
14-2:
Now, knowing just enough
to be dangerous, and in
need
of a shot of
humility, change line
55 so that each value of AREA is rounded
(down) to be accurate
to
one decimal place.
For
example:
RADIUS
1
AREA
3.
1
etc.
Ummm
yaas.
Hang in there. It's super-simple.
75

Other manuals for Radio Shack TRS-80

Related product manuals