关于map的输入与输出
为什么将元素插入到map后,输出这些元素,但是输出的顺序不是按我输入的顺序,我用的是vc6.0编译器
比如:
map<string,string> trans_map;
typedef map<string,string>::value_type valueType;
trans_map.insert(valueType("gratz","grateful"));
trans_map.insert(valueType("em","them"));
trans_map.insert(valueType("cuz","because"));
trans_map.insert(valueType("nah","no"));
trans_map.insert(valueType("sez","says"));
trans_map.insert(valueType("thanx","thanks"));
trans_map.insert(valueType("wuz","was"));
trans_map.insert(valueType("pos","suppose"));
输出为:
cuz because
em them
gratz grateful
nah no
pos suppose
sez says
thanx thanks
wuz was
谢谢:)