大数加法运算,结果出现问题,出现星号。请教问题在哪里?
cleardime x46 (46),y46(46),s46(46)
for i=1 to 46
x46(i)=0
y46(i)=0
s46(i)=0
endfor
accept'请输入加数:'to x
accept'请输入被加数:'to y
for i=1 to int(len(x)/5)+1
x46(i)=val(right(x,5))
x=subst(x,1,len(x)-5)
endfor
for i=1 to int(len(y)/5)+1
y46(i)=val(right(y,5))
y=subst(y,1,len(y)-5)
endfor
for i=1to 46
s46(i)=x46(i)+y46(i)
if s46(i)>=460000
s46(i+1)=val(subst(allt(str(s46(i))),1,len(allt(str(s46(i))))-5))
s46(i+1)=val(right(allt(str(s46(i))),1,5))
endif
endfor
wait
y=''
for i=46 to 1 step-1
if s46(i)>0
y=y+str(s46(i),5)
endif
endfor
? y
加数:12345678901234567890
被加数:12345678901234567890
结果:24690****24690****