打印顺序问题
#include <stdio.h>
#include <map>
#include <string>
#include <iostream>
using namespace std;
int main(void)
{
map<string, string> m;
pair<string,string> p1("S","Shang Hai");
pair<string,string> p2("B","Bei Jing");
pair<string,string> p3("G","Guang Zhou");
m.insert(p1);
m.insert(p2);
m.insert(p3);
map<string,string>::iterator itor = m.begin();
for( ; itor != m.end() ; itor++ )
{
cout << itor->first << "-";
cout << itor->second << endl;
}
return 0;
}
为什么打印结果是
B-Bei Jing
G-Guang Zhou
S-Shang Hai
不应该是上海最先被打印出来吗?