功能:
成对出现的数据,利用对组可以返回两个数据
两种创建方式:
1.第一种方式
pair <string, int>p("tom", 20);
cout << " 姓名是 " << p.first << " 年龄 " << p.second << endl;
2.第二种方式
//第二种方式
pair <string, int> m = make_pair("tommm", 30);
cout << " 姓名是 " << m.first << " 年龄 " << m.second << endl;
结果图: