What will be the output of the following C++ code? [code] #include <iostream> #include <iterator> #include <list> using

Ivanesn

New member
What will be the output of the following C++ code?
Code:
    #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. 15
 

Tìm kiếm

Back
Top