map { string,info> mymap;
map {string,info>::iterator it;
// insert into map
it = mymap.find(chrmName);
if ( it !=mymap.end() ) // found id{
it->second.fnc();
}else // not found{
mymap.insert( pair( chrmName, info() ) ) ;
}
it->second.fnc();
}else // not found{
mymap.insert( pair
}
// iterate over map
cout << "map size:" << mymap.size() << endl;
map
int count=0;
int tot = 0;
for ( it3=mymap.begin() ; it3 != mymap.end(); it3++ ){
count++;
cout << it3->first.c_str() << "=>" ;
cout<< it3->second.getCount() << endl;
tot = tot+ it3->second.getCount();
}
count++;
cout << it3->first.c_str() << "=>" ;
cout<< it3->second.getCount() << endl;
tot = tot+ it3->second.getCount();
}
Comments
Post a Comment