adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <iterator>
    #include <list>
    using namespace std;
    int main () 
    {
        list<int> mylist;
        for (int i = 0; i < 5; i++) 
            mylist.push_back (i * 20);
        list<int> :: iterator first = mylist.begin();
        list<int> :: iterator last = mylist.end();
        cout << distance(first, last) << endl;
        return 0;
    }

a.

20

b.

100

c.

5

d.

None of the mentioned

Answer: (c).5

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?