Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- void InsertInto(std::vector <int>& v1, int value, int position){
- auto it = v1.begin();
- it = v1.insert(it+position,value);
- }
- int main(){
- std::vector <int> v1 {5,2,4,5};
- InsertInto(v1,17,2);
- for (auto i: v1){
- std::cout << i << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement