#include<stdio.h> int main() { int sum=0; int i=100; _asm { bg: cmp i,0; jle ext; mov eax,i; add sum,eax; sub i,1; jmp bg; ext: } printf("%d\n",sum); return 0; }
[此贴子已经被作者于2015-10-27 16:48编辑过]
#include<stdio.h> int main() { char* fmt="%d\n"; _asm { mov eax,100; xor edx,edx; bg: cmp eax,0; jle ext; add edx,eax; sub eax,1; jmp bg; ext: push edx; mov eax,dword ptr fmt; push eax; call dword ptr printf; add esp,8; } return 0; }