CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2013
    Posts
    6

    Convert the following C++ code into assembly please quickly

    int x, y;
    while(x > y--)
    {
    if (x>0 && y<0)
    x = y = pow(x , y);
    else if(--x > y++)
    x = x && y;
    else
    y = ( x & y)>> 3;

    }
    Last edited by manarzaid; May 1st, 2013 at 09:43 AM.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Convert the following C++ code into assembly please quickly

    Why? What do think this c++ code is achieving? It looks fairly nonsensical. It doesn't even set initial values for x and y.
    Last edited by 2kaud; April 30th, 2013 at 01:27 PM.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Convert the following C++ code into assembly.

    You're already posted this. Please don't repost.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  4. #4
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,754

    Re: Convert the following C++ code into assembly.

    Duplicate posts (aka SPAM) are being removed. Please consider this your only warning that duplicate posts are considered spam and can result in you being banned from the forum.

    Also - this sounds like homework (which most of us won't help with). Why not just stick this into your compiler and let it generate the assembler code for you? Edit: Just looked at the code. I agree with what has been said - it is junk code, so this must be homework!

    Brad! Jones
    Admin
    Last edited by Brad Jones; April 30th, 2013 at 01:50 PM.
    -----------------------------------------------
    Brad! Jones,
    Yowza Publishing
    LotsOfSoftware, LLC

    -----------------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured