The
VAL
function converts each extracted string literai into a numeric
value:
When
1= 16,
B=VAL(MID$(B$,16,1))
B=VAL($1~171914131517121)
B=m
When
1= 15,
B=VAL(MID$(B$,15,l)) .
After
each
digit
of the numeric string
is
converted into a numeric constant.
the necessary calculations to add them together are performed before the loop
reiterates, The calculations to arrive at
C$
are done in lines 1060 to 1090,
10013
N=l
1010
D=0
10213
FOR
I=LEN(A$)
TO
1 STEP
-1
1
(14(1
A=A+
Il
:II=0
11350
B=VALCMID$CB$.I.l»
106(1
C=A+B
10713
IF
C>=l13
THEN
D=l
10813
IF
D=l
AND
1=1
THEN
N=2
10913
C$=RIGHT$CSTR$(C).N)+C$
111313
NEXT
1
Initialize string pointer
N.
Initialize carry value.
Initialize decrement counter
1.
Extract digits separately. Convert
to non-string
nu
meric.
Add tens value from carry
(0)
to
A.
Extract digits separately. Convert
to non-string numeric.
Add extracted digits of A$ and
B$.
Carry tens value into D if
C>=10.
Link sums into string answer.
Variable D
is
initialized to zero at line 1010 and used
as
a carry value in lines
1040, 1070. and 10S0. During addition,
if
the value of C
is
greater than or equal to
ten, a tens value
is
carried over to the next left position. The tens value éarried
over
is
stored in
D:
2 3
+1
4
+1
5
+'6
'1
7
+1
8
901
2
+ 5 7 9
43572
23
5 1 4 7
32584
193