Step 5: Concatenate the answer strings. CH$ and CL$, together by
numeric string concatenation. They are concatenated in statement 1120:
1121::1
C$=CH$+CL$
C$=CH$c::J+
CL$c:=::J
C$= 1 1
Only the rightmost
"F"
numbers from CL$ are concatenated to CH$ to avoid
concatenating any leading blanks in CL$
(see
the earlier
"Numeric
Strings" sec-
tion for further discussion).
Step 6: Truncate leading zeros in
C$
before C$
is
printed. Leading zeros
are subtracted in the same
way
for Multiple Integer Subtraction
as
for Numeric
String Subtraction
(see
step
5,
"Numeric String Subtraction:' page 205). Lines
1130 through 1170 truncate leading zeros just prior to printing C$:
1130
FOR
1=1
Ta
LENCC$)
1140
IF
VALCMID$CC$,I,I»=0
THEN
L=L+1
1150
IF
VALCLEFT$CC$,I»<)0
THEN
I=LENCC$)
1160
t'~E~-:;T
1
1170
C$=RIGHT$CC$,LENCC$)-L)
.1
1::::1::1
IF
S=1
THEt~
C$="-"+C$
If
A$
and
B$
had
been switched, S
would
have been set to
1,
signaling a negative
answer, and thus a negative sign
would
be
concatenated to the front of
C$
at
1180.
Step 7: Print the answer
and
clear out variable strings before allowing
another problem to
be
input.
J.
190
PF: 1
NT
•
F'F:
1
tH"
At·jS~,jER=
".; C$ •F'R 1
tH
.1200
A$="'"
E:$=""
C$="'"
CH$=""
•
CL$=""
1205
AH=0·AL=0·BH=0BL=0
F=0.S=0X=0.Y=0
121(1
GOTO
2t1
.1220
am
213