stl中vecter和pair组合达到字典的效果
typedef std::pair<string, int> beanUnit;
std::vector<beanUnit> vec;
vec.push_back(beanUnit("xuhaitao",36));
vec.push_back(beanUnit("wangerxiao",63));
vec.push_back(beanUnit("jidan", 25));
vec.push_back(beanUnit("mao", 5));
std::vector<beanUnit>::iterator i = vec.begin();
std::vector<beanUnit>::iterator end = vec.end();
while (i != end) {
cout << i->first <<i->second << endl;
++i;
}
FR:hunkxu