主题:想加分的就来吧!
有劳个位大虾,把这个QB程序,转换成PASCAL程序!
DEFLNG A-Z
INPUT X
FOR i = 1 TO 3 ^ 8
s$ = SSS$((i))
IF XXX((s$)) = X THEN PRINT s$
NEXT
FUNCTION SSS$ (a)
b$ = "1"
FOR i = 50 TO 57
c = a MOD 3
a = a \ 3
IF c > 0 THEN b$ = b$ + MID$("+-", c, 1)
b$ = b$ + CHR$(i)
NEXT
SSS$ = b$
END FUNCTION
FUNCTION XXX (s$)
DO
a = VAL(s$)
c = LEN(STR$(a))
b = VAL(MID$(s$, c + 1))
d = LEN(STR$(b))
SELECT CASE MID$(s$, c, 1)
CASE "+": e = a + b
CASE "-": e = a - b
CASE ELSE: EXIT DO
END SELECT
s$ = LTRIM$(STR$(e)) + MID$(s$, c + d)
LOOP
XXX = e
END FUNCTION
DEFLNG A-Z
INPUT X
FOR i = 1 TO 3 ^ 8
s$ = SSS$((i))
IF XXX((s$)) = X THEN PRINT s$
NEXT
FUNCTION SSS$ (a)
b$ = "1"
FOR i = 50 TO 57
c = a MOD 3
a = a \ 3
IF c > 0 THEN b$ = b$ + MID$("+-", c, 1)
b$ = b$ + CHR$(i)
NEXT
SSS$ = b$
END FUNCTION
FUNCTION XXX (s$)
DO
a = VAL(s$)
c = LEN(STR$(a))
b = VAL(MID$(s$, c + 1))
d = LEN(STR$(b))
SELECT CASE MID$(s$, c, 1)
CASE "+": e = a + b
CASE "-": e = a - b
CASE ELSE: EXIT DO
END SELECT
s$ = LTRIM$(STR$(e)) + MID$(s$, c + d)
LOOP
XXX = e
END FUNCTION