您的位置:首页 > 大数据 > 人工智能

STL map的遍历与pair的使用

2016-04-24 17:26 489 查看
#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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: