无标题

无标题。

#include<iostream>
using namespace std;
int sum()
{
    __asm(
    "movl $1,%ebx\n"
    "movl $0,%ecx\n"
    //"xor %ecx,%ecx \n"
    "startfor: \n"
    "cmp $100,%ebx\n"
    "jg endfor \n"
    "movl %ebx,%eax\n"
    "mul %eax\n"
    "addl %eax,%ecx\n"
    "incl %ebx\n"
    "jmp startfor\n"
    "endfor: \n"
    "movl $0,%edx\n"
    //"xor %edx,%edx \n"
    "movl %ecx,%eax\n"
    );
}
int main()
{
    cout<<sum()<<endl;
}
发表评论?

2 条评论。

  1. 1-100的平方和?那个 movl $0,%edx 有什么作用?

发表评论

注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

:wink: :twisted: :roll: :oops: :mrgreen: :lol: :idea: :evil: :cry: :arrow: :?: :-| :-x :-o :-P :-D :-? :) :( :!: 8-O 8)

本文链接:https://twd2.me/archives/4916QrCode