Guest User

Untitled

a guest
Jun 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include<vector>
  2. #include<iostream>
  3. using namespace std;
  4. int main() {
  5. vector<int> myvector(3, 100);
  6. vector<int>::iterator it;
  7.  
  8. it = myvector.end();
  9. it = myvector.insert(it, 200);
  10.  
  11. myvector.insert(it, 2, 300);
  12. it = myvector.end(); ////////// here is the point what i want to ask. ///////////
  13.  
  14. std::vector<int> anothervector(2, 400);
  15. myvector.insert(it - 2, anothervector.begin(), anothervector.end());
  16.  
  17. int myarray[] = { 501,502,503 };
  18. myvector.insert(myvector.begin(), myarray, myarray + 3);
  19.  
  20. cout << "myvector contains:";
  21. for (it = myvector.begin(); it < myvector.end(); it++)
  22. cout << ' ' << *it;
  23. cout << 'n';
  24.  
  25. return 0;
  26.  
  27. }
  28.  
  29. it = myvector.end();
Add Comment
Please, Sign In to add comment