#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void print( vector<int> );
int main()
{
vector<int> vec(5);
print( vec );
vector<int>::iterator p = vec.begin();
cout << *p << endl;
vec.insert( vec.begin(), 9 );
print( vec );
cout << *p << endl;
p = vec.begin();
cout << *p << endl;
vec.erase( vec.begin() );
print( vec );
vec.insert( vec.begin() + 2, 8 );
print( vec );
vec.erase( vec.begin() + 2 );
print( vec );
vec.insert( vec.end(), 7 );
print( vec );
vec.erase( vec.end() - 1 );
print( vec );
vec.insert( vec.begin() + 3, 6 );
print( vec );
vec.erase( find( vec.begin(), vec.end(), 6 ) );
print( vec );
vec.insert( vec.begin() + 1, 3 );
vec.insert( vec.begin() + 5, 3 );
print( vec );
vec.erase( find( vec.begin(), vec.end(), 3 ) );
vec.erase( find( vec.begin(), vec.end(), 3 ) );
print( vec );
vec[0] = 23;
vec[1] = 2;
vec[2] = 16;
vec[3] = 45;
vec[4] = 16;
print( vec );
sort( vec.begin(), vec.end() );
print( vec );
return 0;
}
void print( vector<int> v ) {
vector<int>::iterator p = v.begin();
while ( p != v.end() )
cout << *p++ << " ";
cout << endl;
}