#include<iostream>
#include<cstdio>
#include<utility>
using namespace std; typedef pair<string,int> P; int main()
{
//pair类型定义以及赋值
//pair用first访问第一个元素,second访问第二个元素
pair<string,int> p1("Clno1",);
pair<string,double> p2;
p2.first="Clno1";
p2.second=6.66;
cout<<"p1:"<<p1.first<<" "<<p1.second<<endl;
cout<<"p2:"<<p2.first<<" "<<p2.second<<endl; //用make_pair生成新的pair类型数据
pair<string,int> p3;
p3=make_pair("Clno1",);
pair<string,int> p4=p3;
cout<<"p3:"<<p3.first<<" "<<p3.second<<endl;
cout<<"p4:"<<p4.first<<" "<<p4.second<<endl; //用typedef精简代码
P p5=make_pair("Clno1",);
cout<<"p5:"<<p5.first<<" "<<p5.second<<endl; return ;
}