我是初手,请大家帮我作这道题。thanks!
求两个数之和的绝对值
------解决方案--------------------------------------------------------
#define sumabs(a,b) (a+b>0?a+b:-a-b)
------解决方案--------------------------------------------------------
看错版面了
原型:unsigned int __stdcall sumabs(int x,int y)
sumabs:
mov eax,[esp+4]
add eax,[esp+8]
cmp eax,0
jg @f
neg eax
@@:
ret 8
------解决方案--------------------------------------------------------
- Assembly code
example: mov ax,-3 mov bx,2 add ax,bx cmp ax,0 jl abs jmp dispabs: neg axdisp: