unordered_map
#include "iostream"
#include"unordered_map"
using namespace std;
#include <string>
int main ()
{
std::unordered_map<std::string,double> mymap;
std::pair<std::string,double> myshopping ("dad",0.3);
std::pair<std::string,double> myshopping1 ("mom",0.1);
mymap.insert(myshopping);
mymap.insert(myshopping1);
std::string input;
std::cout << "who? ";
getline (std::cin,input);
std::unordered_map<std::string,double>::const_iterator got = mymap.find (input); //返回input作为关键字的迭代器
if ( got == mymap.end() )
std::cout << "not found";
else
std::cout << got->first << " is " << got->second;
std::cout << std::endl;
return 0;
}