#include <iostream>
#include <map>
using namespace std;
int main(){
typedef multimap<int, char> M;
typedef M::value_type v_t;
char ch = 'A';
M m;
for (int i = 0; i < 5; i++){
m.insert(v_t(i++,ch++));
}
m.insert(v_t(4,'F'));
M::iterator it = m.begin();
cout << "multimap m:" << endl;
while (it != m.end()){
cout << it->first << "-" << it->second << endl;
it++;
}
it = m.find(4);
if (it != m.end()){
cout << "element key '4' has value" << it->second << endl;
}else{
cout << "element key '4' not found." << endl;
}
M::iterator upp = m.upper_bound(4);
cout << "all elements with key '4'" << endl;
while (it != upp){
cout << it->first << "-" << it->second << endl;
it++;
}
return 0;
}