Please explain to me how to solve:
Line 4: In main: num1 = _______, num2 = _______, and t = _______
Line 11: In funOne: a = _______, x = _______, z = _______, and t = _______
Line 13: In funOne: a = _______, x = _______, z = _______, and t = _______
Line 15: In funOne: a = _______, x = _______, z = _______, and t = _______
Line 17: In funOne: a = _______, x = _______, z = _______, and t = _______
Line 6: In main after funOne: num1 = ______, num2 = ______, and t = _____
Line 19: In funTwo: u = ______, v = ______, aTwo = ______, and t = ______
Line 11: In funOne: a = _______, x = _______, z = _______, and t = _______
Line 13: In funOne: a = _______, x = _______, z = _______, and t = _______
Line 15: In funOne: a = _______, x = _______, z = _______, and t = _______
Line 17: In funOne: a = _______, x = _______, z = _______, and t = _______
Line 21: In funTwo after funOne: u = ______, v = ______, aTwo = ______,
and t = ______
Line 23: In funTwo: u = ______, v = ______, aTwo = ______, and t = ______
Line 25: In funTwo: u = ______, v = ______, aTwo = ______, and t = ______
Line 8: In main after funTwo: num1 = ______, num2 = ______, and t = _____
Here is the code below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
// Example: Reference and value parameters
#include <iostream>
using namespace std;
int t;
void funOne (int& a, int& x);
void funTwo (int& u, int v);
int main ( )
{
int num1, num2;
num1 = 10; // Line 1
num2 = 20; // Line 2
t = 15; // Line 3
cout << “Line 4: In main: num1 = ” << num1 << “, num2 = ”
<< num2 << “, and t = ”<< t << endl; // Line4
funOne (num1, t); // Line 5
cout << “Line 6: In main after funOne: ”<< “num1 = ”
<< num1 << “, num2 = ” << num2 << “, and t = ”<< t
<< endl; // Line6
funTwo (num2, num1); // Line 7
cout << “Line 8: In main after funTwo: ”<< “num1 = ”
<< num1 << “, num2 = ” << num2 << “, and t = ”
<< t << endl; // Line8
system(“pause”);
return 0; // Line 9
}
void funOne (int& a, int& x)
{
int z;
z = a + x; //Line 10
cout << “Line 11: In funOne: a = ” << a << “, x = ” << x
<< “, z= ” << z << “, and t = ” << t << endl; //Line 11
x = x + 5; //Line 12
cout << “Line 13: In funOne: a = ” << a << “, x = ” << x
<< “, z= ” << z << “, and t = ” << t << endl; //Line 13
a = a + 12; //Line 14
cout << “Line 15: In funOne: a = ” << a << “, x = ” << x
<< “, z= ” << z << “, and t = ” << t << endl; //Line 15
t = t + 13; //Line 16
cout << “Line 17: In funOne: a = ” << a << “, x = ” << x
<< “, z= ” << z << “, and t = ” << t << endl; //Line 17
}
void funTwo ( int& u, int v )
{
int aTwo;
aTwo = u; //Line 18
cout << “Line 19: In funTwo: u = ” << u << “, v = ” << v
<< “, aTwo = ” << aTwo << “, and t = ” << t << endl; //Line 19
funOne(aTwo, u); //Line 20
cout << “Line 21: In funTwo after funOne: ” << “u = ”
<< u << “, v = ” << v << “, aTwo = ” << aTwo
<< “, and t = ” << t << endl; //Line 21
u = u + 13; //Line 22
cout << “Line 23: In funTwo: u = ” << u << “, v = ” << v
<< “, aTwo = ” << aTwo << “, and t = ” << t << endl; //Line 23
t = 2 * t; //Line 24
cout << “Line 25: In funTwo: u = ” << u << “, v = ” << v
<< “, aTwo = ” << aTwo << “, and t = ” << t << endl; //Line 25
}
|