主题:科学计数法转普通计数法
[color=0000FF]CLS
INPUT a$
WHILE LEFT$(a$, 1) = "0"
MID$(a$, 1, 1) = " "
a$ = LTRIM$(a$)
WEND
la = LEN(a$)
x = INSTR(1, a$, "E")
IF x = 0 THEN x = INSTR(1, a$, "D")
IF x = 0 THEN PRINT a$: SLEEP: END
w = VAL(RIGHT$(a$, la - x))
p = INSTR(1, a$, ".")
s$ = LEFT$(a$, x - 1)
DIM a$(LEN(s$))
IF w < LEN(s$) - 1 THEN
FOR i = 1 TO LEN(s$)
a$(i) = MID$(a$, i, 1)
NEXT i
FOR i = p TO p + w - 1
SWAP a$(i), a$(i + 1)
NEXT i
FOR i = 1 TO LEN(s$)
x$ = x$ + a$(i)
NEXT i: s$ = x$
IF RIGHT$(s$, 1) = "." THEN MID$(s$, LEN(s$), 1) = " ": s$ = RTRIM$(s$)
ELSE
IF p > 0 THEN
FOR i = 1 TO LEN(s$)
a$(i) = MID$(s$, i, 1)
IF a$(i) = "." THEN a$(i) = ""
NEXT i
FOR i = 1 TO LEN(s$)
x$ = x$ + a$(i)
NEXT i: s$ = x$
END IF
s$ = s$ + STRING$(w - LEN(s$) + 1, "0")
END IF
PRINT s$
SLEEP
END[/color]
[color=FF0000]? 1D10
10000000000
? 1.23454E9
1234540000[/color]
[color=000000]有许多不足之处,希望高手来改正。[/color]
INPUT a$
WHILE LEFT$(a$, 1) = "0"
MID$(a$, 1, 1) = " "
a$ = LTRIM$(a$)
WEND
la = LEN(a$)
x = INSTR(1, a$, "E")
IF x = 0 THEN x = INSTR(1, a$, "D")
IF x = 0 THEN PRINT a$: SLEEP: END
w = VAL(RIGHT$(a$, la - x))
p = INSTR(1, a$, ".")
s$ = LEFT$(a$, x - 1)
DIM a$(LEN(s$))
IF w < LEN(s$) - 1 THEN
FOR i = 1 TO LEN(s$)
a$(i) = MID$(a$, i, 1)
NEXT i
FOR i = p TO p + w - 1
SWAP a$(i), a$(i + 1)
NEXT i
FOR i = 1 TO LEN(s$)
x$ = x$ + a$(i)
NEXT i: s$ = x$
IF RIGHT$(s$, 1) = "." THEN MID$(s$, LEN(s$), 1) = " ": s$ = RTRIM$(s$)
ELSE
IF p > 0 THEN
FOR i = 1 TO LEN(s$)
a$(i) = MID$(s$, i, 1)
IF a$(i) = "." THEN a$(i) = ""
NEXT i
FOR i = 1 TO LEN(s$)
x$ = x$ + a$(i)
NEXT i: s$ = x$
END IF
s$ = s$ + STRING$(w - LEN(s$) + 1, "0")
END IF
PRINT s$
SLEEP
END[/color]
[color=FF0000]? 1D10
10000000000
? 1.23454E9
1234540000[/color]
[color=000000]有许多不足之处,希望高手来改正。[/color]