那个用汇编的显然用了条件判断跳转指令(cmp,jle),肯定不合题意。

能编个毛线衣吗?
2015-10-30 08:11
2015-10-30 08:12
2015-10-30 08:17
2015-10-30 08:19
2015-10-30 08:29
2015-10-30 08:45
程序代码:#include<stdio.h>
int main()
{
char* fmt="%d\n";
_asm
{
mov eax,100;
add eax,1;
xor edx,edx;
push eax;
shl eax,6;
add edx,eax;
pop eax;
push eax;
shl eax,5;
add edx,eax;
pop eax;
shl eax,2;
add edx,eax;
shr edx,1;
push edx;
mov eax,dword ptr fmt;
push eax;
call dword ptr printf;
add esp,8;
}
return 0;
}

2015-10-30 09:16
[此贴子已经被作者于2015-10-30 09:31编辑过]
2015-10-30 09:23
2015-10-30 09:32
程序代码:#include<stdio.h>
int main()
{
char* fmt="sum=%d\n";
int i=1;
int j=100;
int k=i+j;
int m=k;
int sum=0;
sum+=k<<6;
k=m;
sum+=k<<5;
k=m;
sum+=k<<2;
sum>>=1;
printf(fmt,sum);
return 0;
}

2015-10-30 09:40