C++ make_pair()用法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010164190/article/details/88344432
#include <iostream>
using namespace std;

int main () {
  pair <string,double> p1 ("zhang",8.8);
  pair <string,double> p2;
  pair <string,double> p3;

  p2.first = "wang";
  p2.second = 1.03;

  p3 = make_pair("li",2.09);
  
  cout << "p1  " << p1.first << " is " << p1.second << endl;
  cout << "p2  " << p2.first << " is " << p2.second << endl;
  cout << "p3  " << p3.first << " is " << p3.second << endl;
  return 0;
}

猜你喜欢

转载自blog.csdn.net/u010164190/article/details/88344432
今日推荐