#include #include using namespace std; #include "ordered_pair.h" int main() { multiset S; multiset::iterator itr; // Insert the ordered pairs (0,0), (0,1), (0,2), (1,0), ..., (2,2) // into the container. for ( int n = 1; n <= 2; ++n ) { for ( int i = 0; i < 3; ++i ) { for ( int j = 0; j < 3; ++j ) { S.insert( ordered_pair( i, 10*n + j ) ); } } } // Print the number of objects in the container cout << "Size of S: " << S.size() << endl; // List the objects in the container for ( itr = S.begin(); itr != S.end(); ++itr ) { if ( itr != S.begin() ) { cout << ", "; } cout << *itr; } cout << endl; // Remove the ordered pair (1,1) cout << "Removing (1,1)..." << endl; S.erase( ordered_pair( 1, 1 ) ); cout << "Size of S: " << S.size() << endl; // List the objects in the container for ( itr = S.begin(); itr != S.end(); ++itr ) { if ( itr != S.begin() ) { cout << ", "; } cout << *itr; } cout << endl; return 0; } /**************************************************** OUTPUT Size of S: 18 (0,10), (0,11), (0,12), (0,20), (0,21), (0,22), (1,10), (1,11), (1,12), (1,20), (1,21), (1,22), (2,10), (2,11), (2,12), (2,20), (2,21), (2,22) Removing (1,1)... Size of S: 12 (0,10), (0,11), (0,12), (0,20), (0,21), (0,22), (2,10), (2,11), (2,12), (2,20), (2,21), (2,22) ****************************************************/