adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <algorithm>
    #include <vector>
    using namespace std;
    int main () 
    {
        int first[] = {5, 10, 15};
        int second[] = {50, 40, 30};
        vector<int> v(4);
        vector<int> :: iterator it;
        sort (first, first + 3);
        sort (second, second + 3);
        it = set_symmetric_difference (first, first + 2, second, second + 2, 
        v.begin());
        v.resize(it - v.begin());
        for (it = v.begin(); it != v.end(); ++it)
        cout << ' ' << *it;
        return 0;
    }

a.

5 10

b.

30 40

c.

50 40

d.

5 10 30 40

Answer: (d).5 10 30 40

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?