adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <algorithm>
    using namespace std;
    bool myfn(int i, int j) 
    {
        return i < j;
    }
    int main () 
    {
        int myints[ ] = {3, 7, 2, 5, 6, 4, 9};
        cout <<  *min_element(myints, myints + 7, myfn) << '\n';
        cout << *max_element(myints, myints + 7, myfn) << '\n';
        return 0;
    }

a.

2 9

b.

2 7

c.

3 9

d.

3 5

Answer: (a).2 9

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?