Computer_Programming_in_BASIC_Part_1_of_4_BASIC_Basics.pdf

(15982 KB) Pobierz
Computer
Programming
in BASIC
A
unique. teach
-yourself
course
Part
by
1:
BASIC
Basics
Ian Williamson
,
Rodney Dale
and
Tim
Eiloart
CopYright
@
Ian
Williamson
,
Rodney Dale
and Tim
EII03rl
All
right
s
r
ese
rv
ed.
No
pa
r
I of
t
his
public ati
o
n
may
~
,.eproduced
,
stored
in
a
relri
ellal syste
m,
Or
1979
transmitted in
IIn
y
form
or
by
IIny
m"a"
s
.
e
lectn:m
k.
mechanical,
photocopying.
recording.
or
other"li
se,
v
it
hou
l
th
l!
prior
JH'rmlulon
of t
he
copyr
ight
o
wner.
!'lnl
publi
s
hed
1979.
Repr
l
n
ll!d 1960
(t
....
ke)
.
1981, 1982
ISBN
0
905946
·05
7
published
by
Cambridge
learning
limited
Rivermill
lodge
St. Illes
Hunt
ingdon
Cambridgeshire
U.K.
printed in
England bV
Cambridge Learning Limited
CONTENTS with Summaries
PROGRA/-KD
LEARNING
Thh
coliue
.
CCl'IPUTER
PROGRAMHIIIG
I
II
BAStC
,
conslns
of
(C
IiC
Page nunb"r
"er
r-instruction
o
r
p
cog cll_d
l" ..
r
ni
ng
book.
.
Wa
r
nin'1
b~
...If-lm'
tr
,,,,t1on
h."
the
.d"a"ug"
of beln'l
quicker
and IIQ
ce
ehoroll9l>
th;tll
cla.",r """, 1...
rn1"".
The
.tud"nt work
..
at
1115
Or
her
oom
speed and is
r"9"I1
..
d~
asked
t
o
r
espond II,.. a
",,_rill9
• question o
r
sol.,1n9
It
p
r
obl"," on
new
fn
f
o
r
.
H
on
beto
..e
continuing
tile
COUl'se
.
USING
THIS TEXT
H<;w
thl.
COline
1.
designed
to
be
h19h1'1
effecti.ve
..."ethee
o
r
not
'Iou
have
.
"ce ...
to
.. ",,",pllte
...
LESSON 1
WHAT
IS
A
CMUTER
?
Mil",..
"efined
80
that
'1011
"Jll
be
able
to unde
r
.
tand
the
l"
•• ons
that
f
o
ll.,..,
Mel
tall'
to
people abou
t
"","pute
r
s
.
e.",,,,.
a....
LESSON 2
WHA
T
C(JI'UT[RS
ARC 9[Sl
AI DOING
If
people ageN
on
the
c1
ght
..."
...
t
o
Uckl
e
p
r
obl".
,
Jt is
l1
k
el,..
that
a ",,",pll
cer
Col"
be
programmed t
o
.olv~
it ver v
quicklV.
"dth no ,.i.t
.. ke.
.
Wh
..
r
..
people
do not .9
r
_
.
then ..
compUter c
..
nnot ..... llV
help.
"
18
LESSON)
SAYING
IT
W
ITH
LEITERS
SClll!etiOll!.s
vou
u.s
..
initi .. l
l~tte
r
. . ..s
a tVPf'
oE
.hor
t
hand. EoI' e
"
a",ple:
·
P.T. O.·
Eo
r
·
Pl~
.s~
[urn
o
v~r·
.
When
\IOu progr_ • compu
t
e
r
vou use this
.pprNlch
all
the
tillle.
LESSON 4
READ
,
DATA,
PRIN
T,
EM)
for
a
.
i~le
progfB'"
/low
you
can
sU
r
t
20
to ItOr k out
.simp
l
~
probleJO."
u,l1ng
&\sIC.
LESSON
~
Rl.INNlNG BASIC PROCRAHS
When
you
ItOrk
on- li"..
~O<I
have
to
under.tand the
thin9" the
computer ."v•
a
......
11 a"
l<novin9
/lokr
to ..
r
Ite
~ou
r
prog
r
a",
.
22
LESSON 6
LESSON 7
A"IO
l
HER BASIC PROGRAH
EXAMPLE
27
RAISING
TO
A POWER
.nd
9 1 . 1 /
In
...htch
\10"
1......n to ev,,],,"te, 14.
J6"
·
S.
JJ. 17
%
9"·7
"nd
si.ll"l' p
r
oblems.
"
J6
LESSON
8
BRACKETS
(or PAREN
THEs[S)
In uthematlcal
ter ... (1
J)
" 4
1"
vel',!
diEE..r
ent
ECOIO:
1
(J
Jt
4
).
LESSON
9
EXPRESS
I
ONS
In ...h1ch
vou
l
ea
rn t
o
...
cit
..
COOlplicated
lUt.he..atic ..
1
probl~."
.
IIsin9
br
.ck~t " (pa
ren~.s~.)
.
in
&\SIC.
LESSON
10
LARGt
AM)
SHALL NtHSERS
In
..
hich
Vou
and
.so
Eorth.
l~.cn
..
bout 1.
46
Jt
1,9.
&lid
3.1
Jt
,,_6
Pa ge
nUllbl!f
LESSON
11
N(H3[RS
IN
BASIC
//ott
to ...
r
ite
nUllll>eu
~LlCh
u
2
.46
If
1,9
in BASIC
.
"
LESSON
12
VAR
I
ABLE
_NAHCS
IN BASIC
A
"
..
ri
..
bl.-n~
...
ili/ht
M C
f
o
r the
e
...
h
in
"'v
pocleet.
II
the
m~ber
of
b"tton~
in the
~
.....illg
b.,.leet. But
i t
ba.
to
folleM
the
ru
le.
of
BASIC.
LESSON 13
HI:
LET
STATEHCNT
When
IIOU ...
rite
UT
r-
r.
I
lfOu
don
'
t
breale the
r
ule~
o
f
BASIC,
bec ..
u~e
in
thl"
COlIte"t
_
-.on •
becoIIM!~.
r
..
the r tha n
·
eq
u
.
J
~
·
-
a
J
differellce
fo
r
.11
BASIC
progr~~.
"
"a
..
LESSON lQ
Ttt::
PRIN
T
STATEH(NT
Y u
have
u~ed
PRINT
aJre
..
dv.
HeM
.,.ou
.ee
o
/I0oI
t
o
PRINT
..ard"
..
"
....
11
."
nWllber
"
,
and
hoi.!
t
o
PlUH't
...
o
ur
re"ult~
in
fl""
co
lWllll.
aeras.
the page.
LESSON
15
ERRORS IN
BAS
I
C
Your
..
b ulee"
,flight
he
picked
up
by the
COIlIpuur
.nd
r
ejected
.
Or 'lou
.
.....
"ritl!
progriJJII
th.t
happen.
to
be
qua"
the
"t01Ig
""'"
,
bec.u~1!
lfOu
fo
r
got
heN
the
COJIIput"r
..auJd
und"r"t.nd 'lou
r
..ard~
.
'T'he C'OIIIputer
then
dooo~
"h.t \/OU
t.ll
it
to
do
,
nOt
..h ..
t
lIoU ....nt
i t
t
o
do .
'"
5)
LE
SSON
16
US
l~
WHAT YOU KNOW
ellough to
u~e
• c""pu
t
e
r
in
e.rne.t,
for caJcul.Ung
the e.e1.....
te~
needed
fI
....
c.rpenter.
You""",
LESSON 17
ANOTtt::R PROBLEM
meM
You
e .. n
progre,,~
froJll the c.rpentry
.
hop
to the
b ..
lee ..
'
.
o""n.
we
hope
you
can
.
t ..
r
t to de.1 ..
1
th
..
lmo" t
.." ...
repetit/""
e.t/... te"
u"/ng
,,1.
ple
co.t. of
tla.e and .,ter iaJ ••
SlI'PL(H(N
l
ARY LESSON
1
CCl
lING
SlAR
T£D
"
"
"
65
HOt<
\/OU
Jog-Oil
to •
computer,
leeybo.lrd
nd
deJete ..i.
e.lee•.
MOl![
BASIC C(I+IA."I)S
tl!l'IIi""l
SlI'PL£I£NTARY
LESSON 2
Horl!
f.clliUe.
\/OU
...111
lIud
",hell
lIoU
.r"
connected
to
• cO/llputl!r
.
SUPPLEMCNIARY
LESSON
J
C()f'U1ERS
AS CALClA.A
TORS
you
"Y
....
lit
t
o
u,,"
.. CO/IIputl!r fo
r
,,1.pJe
.rit:lwl!tlc.
It
16 ..
..,u· t
"
o
f the
CO/IIput l!r
'
.
pa..er,
but
hl!r"
I"
hI:N
to
do
it.
Zgłoś jeśli naruszono regulamin