Question: Q#1. The following program asks the user to enter two numbers. What is the output of the program if the user enters 67 and 90?

Q#1. The following program asks the user to enter two numbers. What is the output of the program if the user enters 67 and 90? (1)

#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 << " " << y << " " << z << endl;

func1(x, y);

cout << "Using the first function in main, new values of x, y and z are " << x << " " << y << " " << z + 100 << endl << endl;

func2(x, y, z);

cout << "Using the second function in main, new values of x, y and z are " << x << " " << y << " " << z << endl << endl;

func3(x, y, z);

cout << "Using the third function in main, new values of x, y and z are " << x << " " << y << " " << z << endl;

return 0;

}

void func1(int &a, int &b)

{

cout << "Enter two numbers: " << endl << endl;

cin >> a >> b;

}

void func2(int &a, int &b, int &c)

{

a = b + c;

b *= 2;

c++;

cout << "Inside the second function x, y and z are " << a << " " << b << " " << c << endl << endl;

}

void func3(int a, int b, int c)

{

a = b - c;

cout << "Inside the third function x, y and z are " << a << " " << b << " " << ++c << endl << endl;

}

Q#2. Explain every line of the output. (1.5)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!