// File: map1.C // // Testing the STL map class. // Example modified from documentation on #include #include #include #include // C string library #include // STL map #include // STL string class typedef map mmap ; int main() { mmap months; months["january"] = 31; months["february"] = 28; months["march"] = 31; months["april"] = 30; months["may"] = 31; months["june"] = 30; months["july"] = 31; months["august"] = 31; months["september"] = 30; months["october"] = 31; months["november"] = 30; months["december"] = 31; cout << "December has " << months["december"] << " days" << endl ; mmap::iterator it ; for (it = months.begin() ; it != months.end() ; it++) { cout << (*it).first << " has " ; cout << (*it).second << " days" << endl ; } }