c++ (数据类型 && 对组)
对组 (不需要头文件的)
//创建对组
void test02()
{
//第一种
pair<string, int> p(string("Tom"), 100);
cout << "姓名: " << p.first << endl;
cout << "年龄:" << p.second << endl;
//第二种
pair<string, int> p2 = make_pair("Jerry", 200);
cout << "姓名: " << p2.first << endl;
cout << "年龄:" << p2.second << endl;
}
浙公网安备 33010602011771号