STL map的遍历与pair的使用

来源:互联网 发布:js如何获取当前时间 编辑:程序博客网 时间:2024/05/24 07:26



#include <iostream>#include <unordered_map>using namespace std;int main(){  //map的遍历  unordered_map<int, int> a;  a[1] = 4;  a[3] = 5;  a[2] = 6;  for (unordered_map<int, int>::iterator it = a.begin(); it != a.end(); ++it){    cout << it->first << " " << it->second << endl;  }  //pair类  pair<int, int> my_pair;  my_pair = make_pair(-9, 9);  int ttt = 0;  return 0;}


0 0
原创粉丝点击