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;

Recommended Answers

All 3 Replies

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.

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

. . 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");

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.