Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 15th International Conference Dasfaa 2010 International Workshops Gdm Benchmarx Mcis Snsmw Diew Udm Tsukuba Japan April 2010 Revised Selected Papers Lncs 6193

Authors: Masatoshi Yoshikawa ,Xiaofeng Meng ,Takayuki Yumoto ,Qiang Ma ,Lifeng Sun ,Chiemi Watanabe

2010th Edition

3642145884, 978-3642145889

More Books

Students also viewed these Databases questions

Question

=+Is the sex appropriate for the organization?

Answered: 1 week ago