1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main ()
{
vector<int> numbers = {1,2,3,4,5,6,7,8,9,10};
cout << "Original vector : \n";
copy (numbers.begin(), numbers.end(), ostream_iterator<int>(cout, " "));
numbers.insert (numbers.begin () + 5, 99);
cout << "\nAfter inserting 99 at position 5 : \n";
copy (numbers.begin (), numbers.end (), ostream_iterator<int> (cout, " "));
system ("pause");
return 0;
}
|