Question: Problem: Starting with the following C++ program: #include using namespace std; void main () { long Var1 = 6; long Var2 = 10; long Var3

Problem: Starting with the following C++ program:

#include

using namespace std;

void main () { long Var1 = 6; long Var2 = 10; long Var3 = 15; long Var4 = 21; long Var5 = 22; long Sum; long Result; long Remainder;

const unsigned short c1 = 6; const unsigned short c2 = 10; const unsigned short c3 = 21; const unsigned short c4 = 15; const unsigned short c5 = 22;

_asm { } cout << "Sum is " << Sum << endl; cout << "Result is " << Result << endl; cout << "Remainder is " << Remainder << endl; }

Inside the block denoted by the _asm keyword, perform the following math operations: Add the values in variables Var1, Var2, Var3, Var4, and Var5. Place the sum into the variable Sum. Calculate the result of the expression: (c1+c2)*(c3c4)/(c5+c1). Place the result into the variable Result and the remainder of the division into the variable Remainder.

This is my code so far and I have the right answers for the Sum and the Result but not Remainder. I don;t know how to get it. #include using namespace std; int main () { long Var1 = 6; long Var2 = 10; long Var3 = 15; long Var4 = 21; long Var5 = 22; long Sum; long Result; long Remainder; const unsigned short c1 = 6; const unsigned short c2 = 10; const unsigned short c3 = 21; const unsigned short c4 = 15; const unsigned short c5 = 22; _asm { mov eax, Var1 add eax, Var2 add eax, Var3 add eax, Var4 add eax, Var5 mov Sum, eax

mov ax, c1 add ax, c2 mov bx, c3 sub bx, c4 mul bx

mov cx, c5 add cx, c1

div cx mov Result, eax mov Remainder, ???????

} cout << "Sum is " << Sum << endl; cout << "Result is " << Result << endl; cout << "Remainder is " << Remainder << endl; system("pause"); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!