Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Translate the following C++ program to Pep/8 assembly language. It multiplies tw

ID: 3633461 • Letter: T

Question

Translate the following C++ program to Pep/8 assembly language. It multiplies two integers using a recursive shift-and-add algorithm:

#include <iostream>
using namespace std;

int times (int mpr, int mcand) {
if (mpr == 0) {
return 0;
}
else if (mpr % 2 == 1) {
return times (mpr / 2, mcand * 2) + mcand;
}
else {
return times (mpr / 2, mcand * 2);
}
}

int main () {
int n, m;
cin >> n >> m;
cout << "Product: " << times (n,m) << endl;

system("pause");
return 0;
}

Any help is appreciated. Thank you!

Explanation / Answer

Please rate: I found one code , may this help you... BR main n: .EQUATE 2 m: .EQUATE 4 retVal: .EQUATE 6 ; ; main: DECI -6,s ; cin>>n; DECI -4,s ; cin>>m; SUBSP 6, i ; push params and retVal CALL times ; DECO retVal, s ; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote