fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. int main () {
  5. std::vector<int> vec {1, 2, 3, 4, 5, 6, 7, 8, 9};
  6. auto it = vec.begin();
  7. vec.insert(it + 3, 10);
  8. for (auto x: vec) std::cout << ' ' << x;
  9. }
  10.  
  11. //https://pt.stackoverflow.com/q/110841/101
Success #stdin #stdout 0s 4548KB
stdin
Standard input is empty
stdout
 1 2 3 10 4 5 6 7 8 9