Chapter 4 Advanced
BASIC
Programming 141
Lines
200
through
230
have the same structure as any
of
the other five
statement groups.
200
REM
GET
12
CHARACTER
NAME
210
R~=3:
C?=9:
L~I?=12:
GOSUB
8000
220
~IAS"'CC$
230
IF
EDITING~
THEN
500
Line
210
assigns values to variables and peforms a GOSUB to line 8000.
Line 8000
is
a
data
entry subroutine; it uses variables R % and C% to specify
where
on
the screen the
data
entry will occur. LN% contains the maximum
length
of
the entry. Line
220
assigns the entered
data
to NA$, the string
variable to hold the name.
Line 230
is
a logical test which you can ignore for now; it will be
explained shortly.
Now check the group starting at line
250.
Although the values assigned to
R%, C%,
and
LN% may differ
and
line 270 is
not
exactly the same, the
structure oflines 250-280
is
identical to
that
oflines 200-270. This
is
the case
for all
of
the other statement groups.
EDITING
DATA
ENTRY
UNES
Once all six lines are entered, the program displays ANY CHANGES?
and waits for a response
of
Y
or
N.
If
the response
is
N, the program will
clear the screen
and
end.
If
the response
is
Y,
the program will ask which
entry line needs to be changed. At this point, the operator can change any
entry lines
at
random until all lines are correct.
The following lines of the
data
entry program in Figure 4-2 perform
these steps:
500
REM
ASK
IF
ANY
CHANGES
ARE
TO
BE
MADE
510
EDITlNO:'::=-l
520
R~=10:C~=0:00SUB
~000
530
QU$="
ANY
CHANGES?
II"
540
OOSUB
3000:REM
GET
"Y"
OR
"N"
550
IF
C$="N"
THEN
PRINT
":'l"; :
END
560
REM
ASK
WHICH
LINES
NEED
CHANGING
570
QUS="WHICH
LINE
(1-6)7:
II"
580
R~=12:LO~=1:HI~=6
390
OOSIJB
3500
600
ON
NM?
GOTO
200,250,300,350,400,450
610
OOTO
520
Line 510
is
of
special interest because it "switches
on"
the editing