Variables - Sharp PC-1403 Operation Manual

Hide thumbs Also See for PC-1403:
Table of Contents

Advertisement

78
Computers are
made
up of many tiny memory areas called
bytes.
Each byte can be
thought
of as a single
character. For
instance,
the
word byte requires four bytes of
memory because there
are four
characters in it. To see how
many bytes are
available
for
use,
simply type in MEM
I
ENTER
].
The
number
displayed
is
the
number
of
bytes
available for writing
programs.
This technique works fine for
words,
but
is very
inefficient
when
you try
to
store numbers. For this
reason,
numbers are
stored in
a
coded
fashion.
Thanks to this coding technique, your computer can store l
a rge
numbers in only
eight bytes. The
largest
number that
can
be stored is +9.999999999
E
+
99.
The smallest
number is
+
1.E-99.
This gives you quite a range
to
choose from.
However,
if the
result of
a calculation exceeds
this
range,
the computer will let you
know
by
turning
on the error annunciator
and
by displaying the error message
in
the
screen.
This annunciator
i
s a
small E
i
n the
upper right-hand
corner
of
the screen.
For
the
error
message,
refer to
Appendix A.
To
see it right now
type
in:
9
~
99
*
9
IENTERI
To get the computer
worki
n
g
properly
again,
just
press the
!£:@
key.
But
how
do you
go
about
storing all this
i
n formation?
It's
really
very
easy.
The computer likes to use
names
for
different pieces of
data.
Let's
store the
number
556 into the computer.
You
may call this
number
by any name that you
wish,
but for this
exercise,
let's use the
letter
R.
The
statement, LET,
can
be
used
to instruct the
computer
to
assign
a
value to
a variable name but only in a
program
statement.
However,
the
LET
command is not
necessary, so we will not use
it very
often.
Now,
type
in
R
=
556 and press
the
I
ENTER
I
.
The
computer
now has the value 556 associated
with
the
letter
R.
These
letters that are
used
to store
i
n formation
are called
variables
.
To see the content of the
variable R,
press the
~
key, the
letter
R key, and the
I
ENTER
I
key.
The
computer
responds by
showing you the
value 556 on the right
of
your
screen.
This ability can
become
very useful when you
are writi
n g
programs
and
formulas.
Next,
let's use the R variable in a
simple
formula.
In
this
formula,
the
variable
R
stands for the radius of a
circle
whose area we want to
find.
The
formula
for
the area
of
a
circle
is:
A="*
R
2.
Type
i
n
R
ISHIFTI
~
2
rn
I
SHIFTI
00
I
ENTERI.
The
result is
971179.3866.
This
technique
of
using
variables
in
equations
will
become
more
understandable
as
we
get
into
writing
programs.
Variables
Those with some
computer
background
may notice that the
last
number (65535)
is
the
same as the largest number i
n
the
special
group of limits
discussed
in
the paragraph
"Limits"
on
page
67.
Hexadecimal notation
is never absolutely
necessary
in
using the
computer, but there are special applications where it is convenient.
Concepts and Terms
of
BASIC

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents