Advertisement
Md_hosen_zisad

LINKLIST

Apr 1st, 2018
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include<iostream>
  2. #include<list>
  3. using namespace std;
  4. int main()
  5. {    
  6.     list<int>l1;
  7.     list<int>l2;
  8.     int n,x;
  9.     cin>>n;
  10.     for(int i=0;i<n;i++)
  11.     {   cin>>x;
  12.         l1.push_back(x);
  13.  
  14.     }
  15.     {   cin>>x;
  16.         l2.push_back(x);
  17.  
  18.     }
  19.     list<int> ::iterator j;
  20.     for(j=l1.begin();j!=l1.end();j++)
  21.     {
  22.         cout<<*j<<" ";
  23.     }
  24.     cout<<endl;
  25.    // cout<<l1.front();
  26.    // cout<<endl;
  27.  
  28.    // cout<<l1.back();
  29.   j++;
  30.    j++;
  31.    j++;
  32.      // l1.erase(j);*/
  33.      //l1.insert(j,2,7);
  34.     // l1.assign(l2.begin(),l2.end());
  35.    
  36.        for(j=l1.begin();j!=l1.end();j++)
  37.     {
  38.         cout<<*j<<" ";
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement