Computer_Programming_in_BASIC_Part_2_of_4_Introducing_BASIC.pdf

(17065 KB) Pobierz
Computer Programming
in BASIC
A unique
.
teach
-
yourself course
Part
by
2
:
Introducing BASIC
Ian
Williamson
,
Rodney
Dale
and
Tim
Eiloart
Copynght
0
Ian W
Illiamson.
Rodney Dale
and
Tim
E,loart
1979
All
r
ights
r
eserved.
No
pari of this publication may
be rep
r
oduced, stored
In
"
r
etrieval
sysl .. m.
or
transmitted
In
any form Or by any means.
elect
r
onic
.
mechanical,
photocopying
.
recording,
or oth"rwlsI!
.... ilhoul
the prior perminion or
the
co
pyr ight
o ... ner
.
First published
1979.
Reprinted
1980
(t
wice)
,
1961, 1982
ISBN
0 905946
05
7
published
by
Cambridge
Learning
Limit
ed
Rlvermill
St.
Ives
Hunhngdon
Cambridgeshire
lodge
UK
printed in England by
Cam
br
idge
Learning
Limited
CONTENTS with
Summar;'s
LESSCN
18
HICH-LEVEL;j'OO
lOW-L[\ [l CCtf'UT[fI
Ifi;;.~-l._l
t:;>
1'I>IJI!~r
l~'iCtMC(S
1.",1:1.1';> ,",",
.uc.~
.OS
U;!l~-.
Jlre
•••
."
l ...
r.~.
!.<:M-lflVf11 lJ",;".,;> .'
an'
""ICII
laO...
11%.
t.~"
:".
.
,,·"t"r'~ ~.".~Jne-.-o:I",
PROCRl.~'H\C:
LESSON 19
s.lSIC
.1.\0
rCtli'tlT[R
r,,-,
:-<1.1,:.,
f!vl!
.
tl!~'
:.~.It
!_~s:.:
'"
"...
JeveloFl !d,
..
nJ
th.
e""-.~t.
r
;rcir~-"-'!n'}.
LESS!)',: 20
wtUl IS
l.
flOltCHl. Rl"
Fl.:n<'::.~.n
• •
r
..
!:~
UIF-~.·-.t.;
to
..
JI"l:J
t!
o"
LESSIN 21
"CRE
--e •."
or
•••
-
no
Ji.9r .....,. eh.t 1".4
"
"
2D
.;.,!!.e/on •.
~BOUT rlO\lt~RI
!\C
lESSO'i
22
US
I\C
HHl.1 Hili K\OW
r"" .un to
.nd
pn.,;>r/l.'
.tel'.
1n
:I.fin.
p
r
obl.,...
"'!e.~ ~5IC
dr."
!
ltNCh.
n.,
-
ehuI!
or
the nve
=!n~.
p
r~r
.
L(SSON 2'
CKP
l
'ilROOOC''\C fU\
CTIO\lS:
5
1\,
COS
,
U'II
,
ARCTA~.
lOC,
~
You
1!l4'i
k.~"".'1001
to
·
.01
.... •
tri.nl1 ..,
tri9on..etr1C.JJ
.nd
.~
to us.'
",Huul
log.
rHh,,,,.
It
IIOU
do not.
.
whle'"
e.1I
be
t.~.h
lesson
e.;)l.ll1 s
t"'e,.1f
f,,:;etlan
... el;)fu! In
n
.o._
;.0;1.' .
""'r~
.
l(SSO'II 2.11
rlJ\CIIO' \S
1\ &lSIC
JO
Les.on
13
~ou
1••
",
t" e"pre,.. tl:e (tllle-t.,, ",
(TOto
."a
.o..-e
ot"'er.
1n &1.31:
Fr~u",
••
L(SSON
2$
HOR(
ABOUI R(AD A'Ll DATA SIAI(I·I( 'HS
-
Itt:
DA
IA
BLOCK
t•
No"
th.
&UIC
Frog'"''
t,
••
t.
R£AD.
IftId
t:lo!1'A
.t.t_lI
..I:ell t"'eJ IfPFe.r In
s.veu!
lln
••
In t"'e
"
r
t:J<}r'JIfI.
A~Itt:R PROCR~M
32
L(SSIN
26
UoU'Pl(
WCICHI
Co\V(RS IIl'I
th" INT"9.'
function
1n • 1111pIe
OOCll£~IAIION
~ou
I".rn
t'>
u."
e..."le.
lCSSOO 271ft : RCM
STAT(H[~1
fOR
or
PR~AH
1'....
fifth
neil
III
pr09
r
......l/19
1.
to
/HI
.un
both
ch,t
ot
...
er
people e.n
Wldeutl fnd lIour
"
r
t:J<}''',
.nd
"hen
thoIt
lt
"
HJ
be
clea,
to
you
lleau
f
ro.".,.. .
IIOU Jook .t
i t
,g,ln.
REIf,rk.
In
the ;rogUII
e""lIf in
.......
t
It I"
,,11
.bout
111 ph
In
£1Iglbh .
"
Page
Ibnber
LESSON
28
INPUT STATDo£N
J
:rhe
INPIlT
sU
t
_ n
t
.11_s '/Ou
to "rHe
p
r
09
r
....."
111
",hlch
the
C'CWput.r a"k" you
fo
r
Il1for "",Uon
-
dau
,
o
r
ad"ice
on
the
COur"e the
progr _ ..houlcf
t
a
ke.
:rhe Il1for... t.ion
can
M .in the
for.. of
nLllllber"
o
r
lette
r
"
(.lph""U11>f!ric).
III
thi ..
eh"pte
r
....
"'ill
M
deal1ng ..olel\1 ...Hh
n..-ben.
and lat ..
r
1n the COUrse ....
,,111
de.l
",lth
letters.
1'1Ie
INPUf'
sUt_nt 1"
f.r .or.. po<i'8rful tor
on
-
line
tfOrk
th.1I
READ
and
/lATA.
"
LE
SSON
29
tOlE
ABOUt PRINt
You
e.n .lre.d\l
PRINT
111
5
zones.
You
IIOW
l ... rll
to
PRI,"
.or e
clo ...
l~
th.n
th.t,
on. n .....
l1ne, 1e.vln",
line
,
or
l ...
"ll1g
gap"
111
the
11ne
.
"
LESSON JO
Ir
••••
TI£N •••• At{)
CO TO
If
the
IF'
••••
THBN
..
t.t
......nt
1"
u"oad, then a
p
r
09r_
"'ill JUI11P
to • nOfl-C"OJI .. ecutl"" line-
nUl11Mr
...hen
cert.in condition
is _to
GO
f'O
.l".~"
_ke"
1t
jlJll1p
to
a
non- con .. ecuti.,..
lina-
nWIIMr.
LESSON
J1
THE
SHI' STATO£N
T
Pr ogr .m"
C.II
M ...
rItten
...
hich ...
ill STOP
ullder
cert.in
condition •
.
"
"
64
LESSON J2
PROCRAM EXAMPLE:
CI£CKINC YOUR
8A~
BALAN((
ThJ" PI'09U"
en.ble.
\IOU
to
INPIlr
the
aaount"
on
the ch,",?ues
and
be "Ure
th.t
the
fl.lI.1 b.lance
is
COrrect.
LESSON JJ
A GOOO PROCRAH CAN
&
A BAD SOLUTION TO A PROCRAM
Good
p
r
ograMWU
h.ve
to
look
clo",dy
. t the
probl ....
Mfore
the~
.. t.rt to code
i.t.
You le.rn
• little
.bollt
.st.Ustl.eal proguJlllflin",.
LESSON
J4
TH(
CCH'UT[R'S Li
MIT
AT
IONS
Ccmputeu
h.ve li/Oited .ccur
.C\I
",hleh
'/Our
progr /JJII.
_~
...
reck
"
70
SLPPL£l.OH ARY LESS()II
4
A
r
UlWCKARTING
SVHElOLS
H"t
of
. .
n~
-or e
rJOIiCluut '\lmbol ..
nd th.ir
.....nillg"
.
Zgłoś jeśli naruszono regulamin