#include
#include
#include
using namespace std;
void print( vector );
int main()
{
vector vec(5);
print( vec );
vector::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 ) );
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 v ) {
vector::iterator p = v.begin();
while ( p != v.end() )
cout << *p++ << " ";
cout << endl;
}