Ask Question
28 December, 22:58

What is the output of the following program?

#include

using namespace std; / /prototype of function find

void find (int& a, int& b, int c);

int main () {

int a, b, c;

a = 1;

b = 2;

c = 3; / /call function find

find (a, b, c);

cout << "first call: " << a << ", " << b << ", " << c << endl; / /call function find

find (a, b, c); cout << "second call: " << a << ", " << b << ", " << c << endl; / /call function find

find (a, b, c); cout << "third call: " << a << ", " << b << ", " << c << endl; system ("pause"); return 0; } / /User defined function with reference parameters

void find (int& a, int& b, int c) { a = b + c; b = a + 1; c = b + 2; }

+4
Answers (1)
  1. 28 December, 23:18
    0
    The output of the following code:

    first call: 5, 6, 3

    second call: 9, 10, 3

    third call: 13, 14, 3

    sh: 1: pause: not found

    Explanation:

    Description to the following method can be described as follows:

    In the given code, a "Find" method is defined, that accepts three integer parameter, in which two variable is "a and b" is reference variable and c is a normal integer variable. Inside the method, variable a adds "b+c" and in the next line, variable b adds a+1, and invariable c adds b+2. Inside the main method, the find method calls three times and prints its value, for the first time it will print 5, 6, and 3. The second time it will print 9,10, and 3, and in the third time, it will print 13, 14, and 3.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What is the output of the following program? #include using namespace std; / /prototype of function find void find (int& a, int& b, int c); ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers