Sharp PC-1500A Instruction Manual page 38

Hide thumbs Also See for PC-1500A:
Table of Contents

Advertisement

A
ll
and
more
about Sharp
PC-1500
at
http://www.PC-
1500.info
As an
example
of a program \Vhich
fails
to do this, enter the follo\ving:
Program
Listing:
1
1
0
A
=
0
20
INPUT
A
30
PRINT A*PI
Keystrokes:
mmrn1
=
l
(]]l••ru
l
rn
oo
rn
mm
OD
rn
m
1."' ..
1
rn oo
moo
rn
oo
rn
m
rn mm
,,.,,.1
Now
imagine
the
user
as
he
runs
the
program
..
.
The
fi rst
thing
that appears on
the
display
is
a question
mark.
'The knowledgeable user will realize
that
some data
is
required but
he
will
have
no
idea
what that data should be.
Suppose
he takes
a
wild guess,
and
luckily, enters a
number.
Suddenly,
a
long
and complicated number appears.
What
does
it mean? He
presses
ENTER
to
continue,
but the
program ends. From his viewpoint, the
whole
experience
has been
a waste of
time. Why? Because of poor programming
.
One
solution
to this problem is
to
use
PRINT
o
r
PAUSE statements to help the user along.
With this
idea
we can re-write our program as follows:
Program Listing:
10
A
=
0
20 PAUSE "ENTER ANY
NUMB
ER"
30
INPUT
A
40 AP
=
A*PI
50 PRINT A; " TIMES Pl
=
";AP
Keystrokes:
CD
rn
rn
(
;;
I
rn
l••u•I
m
oo m
rn
m rn
IIl
'
""'''
1
c:i
IIl
oo
rn
IIl
m
'""•<•I
rnoom
1
..
•c•1rn oo@mmm ,..,,.,, c::i1
••
, ••
,
rn
oo
rn
rn
m
o;o
co
rn
'""'""'
moomm1
=1rnrnmm1 ••TE•I
m
rn
mmrn
oornrn
''"'"'
01
...
"'1
c:J
l•
..
c•!
C!Jo::J
@CD
aJ
1
•,.e<I
ffi
o::J
1
s-.c<l
I
=
I
l•••«I
''""'
I
CJ
I'"'"
I
CJ
rn
m
l•HT••
l
This version
is much
more
useful because
it "prompts"
(or
provokes) the user for
input
and
because
it
identifies
the
output.
36
Do not
sale
this PDF
!!!

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents