Start
by
typing
9 END
We are going to use the space in lines 1 through
8
to
write
and
experiment with a second
little program, and want it to END without plowing
ahead
into the "Flight" program.
The Egg
Timer
It takes time to do everything. Even this foxy box takes
time
to do its thing, though you
may
be awed by its speed.
Type
this:
1 PRINT
"DON'T
GO
AWAY"
2
FOR X
=
1 TO
5000
3 NEXT X
5 PRINT " TIMER PROGRAM ENDED."
...
and
RUN
How long did it take? Well, it did take time,
didn't
it? About
10
seconds? The
Computer
can do approximately
500
FOR-NEXT loops
per second. That means,
by specifying the
number of loops, you can build in
as
long
a time-delay as you wish.
Change
the program to
create a 30
-second
delay. Time
it against
your watch or clock to see
how
accurate
it is.
Answer: 2 FOR
x =
1 TO 15000
EXERCISE
11-1:
Using the space in lines 1 through
8,
design a program which asks
you
how many seconds delay you wish, allows you to enter a number, then executes the delay
and reports back at the end that the delay is over, and how many seconds it took, A sample
answer
is in Part B.
54
Remember back
when we
told you hot
to
do this
(number lines directly
in
sequence}*? Well.,,
if
we hadn't followed
that
rule
we
wouldn't
have
this nice
space to
demonstrate
the
point