0

anyone help me please I need to convert this C++ to assembly
int number = 0;
int targetValue = 1;
int nbrTerms = 0;

cout<< "enter number"
cin >> targetValue;

while( nbrTerms <= targetValue)
{
nbrTerms = nbrTerms + ( targetValue * targetValue)
targetValue ++;
}
cout<< "total terms: "nbrTerms;
return 0;

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by gerard4143
1

Most C++ compilers offer a setting to stop compiling..

In GNU its

g++ file.cpp -S

`-S'
Stop after the stage of compilation proper; do not assemble. The
output is in the form of an assembler code file for each
non-assembler input file specified.

Edited by gerard4143: n/a

0

. . And will more than likely look nothing like it would if you wrote it.

Yeah your probably right but is a starting point...I usually block off the code in question with two inline assembly sections, one at the start of the code in question and on at the end of the code in question..The inline code just has a nop so as not to changed the code

__asm__ ("nop\n\t");

...code in question

__asm__ ("nop\n\t");

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.