pair和map

#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;

}

map:

 

posted @ 2020-07-21 21:02  哎呦哎(iui)  阅读(267)  评论(0编辑  收藏  举报