Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include <iostream>
- #include <list>
- #include <iterator>
- using namespace std;
- void List1(list <int> g)
- {
- list <int>::iterator it;
- for(it = g.begin(); it != g.end(); ++it)
- cout << '\t' << *it;
- cout << '\n';
- }
- int main()
- {
- list <int> list1, list2;
- for (int i = 0; i < 20; ++i)
- {
- list1.push_back(i*2);
- list2.push_front(i*3);
- }
- cout << "\nList 1 (gqlist1) is : ";
- List1(list1);
- cout << "\nList 2 (gqlist2) is : ";
- List1(list2);
- cout << "\ngqlist1.front() : " << list1.front();
- cout << "\ngqlist1.back() : " << list1.back();
- cout << "\ngqlist1.pop_front() : ";
- list1.pop_front();
- List1(list1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement