Josif_tepe

Untitled

Aug 21st, 2025
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <list>
  3. using namespace std;
  4.  
  5. int main() {
  6.     list<int> l1;
  7.     l1.push_front(1);
  8.     l1.push_front(2);
  9.     l1.push_front(3);
  10.     l1.push_back(4);
  11.     l1.push_back(5);
  12.    
  13.    
  14.     l1.pop_front();
  15.     l1.pop_back();
  16.    
  17.     list<int>::iterator it = l1.begin();
  18.     advance(it, 1);
  19.     l1.erase(it);
  20.    
  21.     for(list<int>::iterator it = l1.begin(); it != l1.end(); it++) {
  22.         cout << *it << " ";
  23.     }
  24.    
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment