#pragma warning (disable:4018) #pragma warning (disable:4996) #include #include #include #include #include #include #include using namespace std; template ostream & operator<< ( ostream & out, const pair & p ) { return out << "(" << p.first << "," << p.second << ")"; } template void print( const Collection & v, ostream & out = cout ) { Collection::const_iterator itr = v.begin( ); // begin returns iterator at start // end returns iterator at endMarker out << "[ "; while( itr != v.end( ) ) out << *itr++ << " "; out << "]"; out << endl; } template void print( Iterator begin, Iterator end, ostream & out = cout ) { Iterator itr = begin; // begin returns iterator at start // end returns iterator at endMarker out << "[ "; while( itr != end ) out << *itr++ << " "; out << "]"; out << endl; } class CaseInsensitiveLessThan { public: bool operator() ( const string & lhs, const string & rhs ) { return stricmp( lhs.c_str( ), rhs.c_str( ) ) < 0; } }; int main( ) { /* vector c1; list c2; set s1; set s2; int c3[ ] = { 3, 1, 4 }; c1.push_back( 3 ); c1.push_back( 1 ); c1.push_back( 4 ); print( c1.begin( ), c1.end( ) ); c2.push_back( 3 ); c2.push_front( 4 ); c2.push_back( 1 ); print( c2.begin( ), c2.end( ) ); string s = "silly"; print( s.begin( ), s.end( ) ); print( s.rbegin( ), s.rend( ) ); print( c3, c3 + 3 ); const char *str = "silly"; print( str, str + strlen( str ) ); s1.insert( "hello" ); s1.insert( "ZEBRA" ); s1.insert( "world" ); print( s1.begin( ), s1.end( ) ); s2.insert( "hello" ); s2.insert( "ZEBRA" ); s2.insert( "world" ); print( s2.begin( ), s2.end( ) ); */ map m1; ifstream fin( "data.txt" ); string word; while( fin >> word ) m1[ word ]++; print( m1 ); return 0; }