小编iro*_*arc的帖子

在我的汇编程序中,我试图计算(((((2 ^ 0 + 2 ^ 1)*2 ^ 2)+ 2 ^ 3)*2 ^ 4)+ 2 ^ 5)的等式

在我的80x86汇编程序中,我试图计算(((((2 ^ 0 + 2 ^ 1)*2 ^ 2)+ 2 ^ 3)*2 ^ 4)+ 2 ^ 5)的等式... (2 ^ n),其中每个偶数指数前面都有一个乘法,每个奇数指数前面都有一个加号.我有代码,但我的结果不断取决于所需的结果.当n为5时,结果应该是354,但是我得到330.

任何和所有的建议将不胜感激.

.586
.model flat

include io.h

.stack 4096

.data
number dword ?
prompt byte "enter the power", 0
string byte 40 dup (?), 0
result byte 11 dup (?), 0
lbl_msg byte "answer", 0
bool dword ?
runtot dword ?

.code
_MainProc proc
    input prompt, string, 40
    atod string
    push eax


    call power



    add esp, 4

    dtoa result, eax
    output …
Run Code Online (Sandbox Code Playgroud)

math x86 assembly

2
推荐指数
1
解决办法
102
查看次数

标签 统计

assembly ×1

math ×1

x86 ×1