Josif_tepe

Untitled

Aug 21st, 2025
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <list>
  3. using namespace std;
  4.  
  5. int main() {
  6.     list<int> l1 = {1, 2, 3, 4, 5};
  7. //    cout << l1.front() << endl;
  8. //    cout << l1.back() << endl;
  9.    
  10.     list<int>::iterator it = l1.end();
  11.     it--;
  12.     it--;
  13.     cout << *it << endl;
  14.    
  15.     list<int>::iterator it2 = l1.begin();
  16.     it2 = next(it2, 2);
  17.     cout << *it2 << endl;
  18.     return 0;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment