#include #include #include using namespace std; //myMapempty1.cpp int main() { map m1; multimap m2; map::iterator it, mit; typedef pair mypair; int n1, n2; // if (m1.empty()& m2.empty()) { cout<<"\n map and multimap are empty"; } // keysmust unique in map m1["A"] ="Apple"; m1["A"] ="Apple2"; m1["B"] ="Banana"; m1["C"] ="Coffee"; // keys are not unique in multimap m2.insert(mypair("A","Apple")); m2.insert(mypair("A","Ata")); m2.insert(mypair("A","Atlantic")); n1= m1.size(); n2 = m2.size(); /// if(!m1.empty()){ cout <<"\n !m1.empty() size of map "<< n1; for(it= m1.begin(); it !=m1.end(); it++) { cout<<"\n"<<(*it).first<<" ::: "<< (*it).second; } } // if(!m2.empty()){ cout <<"\n !m2.empty() size of multimap "<< n2; cout <<"\n multimap iterrated with map iteration; --"; for(mit= m2.begin(); mit !=m2.end(); mit++) { cout<<"\n"<<(*mit).first<<" ::: "<< (*mit).second; } } return 0; }