Introduction To Programming In Basic - Sharp MZ-700 Series Owner's Manual

Personal computer
Hide thumbs Also See for MZ-700 Series:
Table of Contents

Advertisement

2.1 Introduction to Programming in BASIC
2.1.1 Direct Mode
Now that you have made some key entries on the MZ-700, you have reached the point where you
are ready to start learning how to program. Before you start, however, try using the MZ-700 as you
would an ordinary pocket calculator. (This is called operating the MZ-700 in the "direct mode".) Key
in the following, just as you would on a pocket calculator.
f4ll+ll9lFllCRl
As you can see, the computer doesn't do anything when it is presented with a problem in this form;
your computer and an ordinary calculator are completely different in this respect, and instructions must
be entered in a form which can be understood by the computer (i.e, in the form prescribed by the BASIC
language). Now try typing in the following.
fpiRimfNim SEEDER]
If you have done this correctly, the number " 1 3 " will be displayed and the screen will appear as shown
below.
R E A D Y
P R I N T
1 3
R E A D Y
4 + 9
PRINT is an instruction which tells the computer to display
something on the screen. Here, the computer is instructed to
display the sum of 4 + 9.
Now let's try doing a somewhat more complex calculation.
With BASIC for the MZ-700, the operators (symbols) for the basic arithmetic operations are as follows.
Addition:
+
Subtraction:
Multiplication:
X
(the asterisk)
Division:
/
(the slash)
Exponentiation:
T
When symbols such a " X ", " + ", and " T " are mixed together in a single arithmetic expression,
the order in which calculations indicated by the symbols are performed is referred to as their priority.
Just as with ordinary algebra, operations can be included in parentheses, so operations within the inner-
most set of parentheses are performed first. Within a set of parentheses, exponentiation is performed
first, followed by multiplication and division (which have equal priority, and therefore are performed
as they are encountered in the expression, from left to right), and then by addition and subtraction.
For example, to obtain the answer to the expression 3 x 6 x C6 + 3 x !9 - 2 x (4 - 2) + II
enter the
following.
t s e m e m
s i m s H E m s B E E B E E m H i B E n B f f l m m
Now try using the computer to do a variety of other problems in arithmetic.
16

Advertisement

Table of Contents
loading

Table of Contents