here is a sample code
Code:
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
multimap<string, string> names;
string n;
names.insert(pair<string, string>("key1", "F"));
names.insert(pair<string, string>("key2", "T"));
names.insert(pair<string, string>("key3", "R"));
multimap<string, string>::iterator p;
cout << "Enter last name: ";
cin >> n;
p = names.find(n);
if(p != names.end()) { // found a name
do {
cout << n << ", " << p->second;
cout << endl;
p++;
} while (p != names.upper_bound(n));
}
else{
cout << "Name not found.\n";
}
return 0;
}