#include <vector>
#include <iostream>
using namespace std;
int main ()
{
// Instantiate a vector with 4 elements, each initialized to 90
vector <int> v (4, 90);
vector <int>::iterator i;
for ( i = v.begin (); i != v.end (); ++ i ){
cout << *i << ' ';
}
// Insert 2 numbers of value 45 at the end
v.insert (v.end (), 2, 45);
cout << "The vector after inserting two elements at the end: ";
for ( i = v.begin (); i != v.end (); ++ i )
{
cout << *i << ' ';
}
return 0;
}
|