主题:来者加分!!!!!!!!
1234qw
[专家分:30] 发布于 2008-05-10 10:00:00
高精度加怎么做???????求助!!!!!!
回复列表 (共3个回复)
沙发
Mato完整版 [专家分:1270] 发布于 2008-05-10 12:16:00
FUNCTION gjdadd$ (x$, y$)
lx = LEN(x$): ly = LEN(y$)
IF lx < ly THEN
SWAP lx, ly: xx$ = y$: yy$ = x$
ELSE
xx$ = x$: yy$ = y$
END IF
yy$ = STRING$(lx - ly, "0") + yy$: c = 0: s$ = ""
FOR i = lx TO 1 STEP -1
ss = VAL(MID$(xx$, i, 1)) + VAL(MID$(yy$, i, 1)) + c
IF ss >= 10 THEN ss = ss - 10: c = 1 ELSE c = 0
s$ = CHR$(48 + ss) + s$
NEXT i
IF c = 1 THEN s$ = "1" + s$
gjdadd$ = s$
END FUNCTION
不是说加分吗?说到的就要做到。
板凳
梦幻小樱 [专家分:140] 发布于 2009-08-06 12:58:00
FUNCTION gjdadd$ (x$, y$)
lx = LEN(x$): ly = LEN(y$)
IF lx < ly THEN
SWAP lx, ly: xx$ = y$: yy$ = x$
ELSE
xx$ = x$: yy$ = y$
END IF
yy$ = STRING$(lx - ly, "0") + yy$: c = 0: s$ = ""
FOR i = lx TO 1 STEP -1
ss = VAL(MID$(xx$, i, 1)) + VAL(MID$(yy$, i, 1)) + c
IF ss >= 10 THEN ss = ss - 10: c = 1 ELSE c = 0
s$ = CHR$(48 + ss) + s$
NEXT i
IF c = 1 THEN s$ = "1" + s$
gjdadd$ = s$
END FUNCTION
3 楼
phile [专家分:2310] 发布于 2009-08-06 19:21:00
简单说一下就是用数组,详细可以看书!
我来回复