C++ Programming

ranslate the program below into PEP/8 assembly language

• Change to output array in same order as input

• Add function twoVect

• Use trace tags on all variables.

a) Comment lines of the source code to trace the C++ code. Cut & paste the Source Code Listing into your assignment document.

b) Run for a set of 4 inputs and paste a screen shot of the Output area of PEP/8.

c) Step thru & Cut and paste the memory trace when in the twoVect function.

 

#include <iostream> using namespace std;

void twoVect(int v[], int n){

int k;

for(k = 0; k < n; k++){ v[k] = v[k] * 2;

}

} int main () {

int vector[4];

int j;

for (j=0; j<4; j++){

cin >> vector[j];

}

twoVect(vector, 4); for (j=0; j<4; j++){

cout << j << ‘ ‘ << vector[j] << endl;

}

return 0;

}

Solution:

Looking for help with your homework?
Grab a 30% Discount and Get your paper done!

30% OFF
Turnitin Report
Formatting
Title Page
Citation
Place an Order

Calculate your paper price
Pages (550 words)
Approximate price: -