adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <algorithm>
    #include <vector>
    #include <functional>
    using namespace std;
    int op_increase (int i)
    {
        return ++i;
    }
    int main ()
    {
        vector<int> a;
        vector<int> b;
        for (int i = 1; i < 4; i++)
        a.push_back (i * 10);
        b.resize(a.size());
        transform (a.begin(), a.end(), b.begin(), op_increase);
        transform (a.begin(), a.end(), b.begin(), a.begin(), plus<int>());
        for (vector<int> :: iterator it = a.begin(); it != a.end(); ++it)
            cout << ' ' << *it;
        return 0;
    }

a.

21

b.

41

c.

61

d.

All of the mentioned

Answer: (d).All of the mentioned

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?