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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started