#include #include using namespace std; #include "ordered_pair.h" int main() { set S; set::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: 3 (0,10), (1,10), (2,10) Removing (1,1)... Size of S: 2 (0,10), (2,10) ****************************************************/