Facebook
From Tom Cruise, 1 Year ago, written in C++.
This paste is a reply to Untitled from Tom Cruise - go back
Embed
Viewing differences between Untitled and Re: Untitled
#include
#include 
#include 
#include 
using namespace std;
void showlist(list g)
{
 list::iterator it;
 for (it = g.begin(); it != g.end(); ++it)
  cout << '\t' << *it;
 cout << '\n';
}
int main()
{
    vector a;\n    for(int i=0;i<=5;i++)\n    {\n        a.push_back(i);\n    }\n        cout<<"Size: "< list list1,list2;
    for (int i = 0; i < 10; ++i) {
  list1.push_back(i * 2);
  list2.push_front(i * 3);
 }
 cout << "\nList 1 (gqlist1) 
is not empty"<         }
        else
        {
            cout<<"Vector isnt empty"<         }
        a.shrink_to_fit();
        cout<<"Vector elements are: "<         for(auto it=a.begin();it!=a.end();it++)
            cout<<*it<<" "<         
: ";
 showlist(list1);
 cout << "\nList 2 (gqlist2) is : ";
 showlist(list2);
 cout << "\nlist1.front() : " << list1.front();
 cout << "\nlist1.back() : " << list1.back();
 cout << "\nlist1.pop_front() : ";
 list1.pop_front();
 showlist(list1);
 cout << "\nlist2.pop_back() : ";
 list2.pop_back();
 showlist(list2);
    cout << "\nlist1.reverse() : ";
 list1.reverse();
 showlist(list1);
    cout << "\nlist2.sort(): ";
 list2.sort();
 showlist(list2);

 
return 0;
}
}