Question: Without running the program, you have to predict the output of the following program, by going over the steps, with proper explanation. #include using namespace
- Without running the program, you have to predict the output of the following program, by going over the steps, with proper explanation.
#include
using namespace std;
void func1(int &, int &);
void func2(int &, int, int &);
void func3(int, int &, int);
int main()
{
int x = 0, y = 0, z = 0;
cout << "x = " << x << " y = " << y << "z = " << z << endl;
func1(x, y);
cout << "x = " << x << " y = " << y << "z = " << z << endl;
func2(x, y, z);
cout << "x = " << x << " y = " << y << "z = " << z << endl;
func3(x, y, z);
cout << "x = " << x << " y = " << y << "z = " << z << endl;
return 0;
}
void func1(int & a, int & b)
{
a = 12;
b = 14;
}
void func2(int &a, int b, int & c)
{
b++;
c--;
a = b + c;
}
void func3(int a, int & b, int c)
{
b = a - c;
c = c + 5;
a = 10;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
