x
每当我运行程序时,为2输入 2y
会得到 4,这很好,但是每当我输入 2 的 3 次方9
时,它应该输出 8,当我输入 3 的 2 次方时,它会输出 8应该给出 9。它适用于 2^2、2^4 但不适用于 2^3。8^8 也给出256
. 程序写错了吗?
/ Start of the main program
Input / Enter the exponent Store y
Subt One
Store Count
Input / Enter the Base
Store x
Store y
Jns Exp
/ Ending the main program
Load Ans
Output
End, Halt
Exp, Hex 0
Loop2, Load Count
Skipcond 800
JumpI Exp
JnS Multiplier
Load Ans
Store x
Load Count
Subt One
Store Count
Jump Loop2
/ Start of the subroutine Multiplier
Multiplier, Hex 0
Load Zero
Store Ans
Loop, Load x
Skipcond 800
JumpI Multiplier
Load Ans
Add y
Store Ans
Load x
Subt One
Store x
Jump Loop
/ Declaration
x, Dec 2
y, Dec 3
Zero, Dec 0
One, Dec 1
Ans, Dec 0
Count, Dec 0