vector和map
2014-08-20 16:14
92 查看
#include "stdafx.h" #include<iostream> #include<vector> #include<string> #include<map> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { typedef map<int,string> word; vector<word> vec; word wd1; word wd2; wd1.insert(make_pair(1, "hello")); wd1.insert(make_pair(2, "vector")); wd2.insert(make_pair(3, "hello")); wd2.insert(make_pair(4, "map")); vec.push_back(wd1); vec.push_back(wd2); for(vector<word>::iterator wordIter = vec.begin(); wordIter != vec.end(); ++wordIter) { for(word::iterator iter = wordIter->begin(); iter != wordIter->end(); ++iter) { cout << iter->first << " " << iter->second << endl; } } return 0; }
相关文章推荐
- Java容器类List、ArrayList、Vector及map、HashTable、HashMap分别的区别
- Java容器类List、ArrayList、Vector及map、HashTable、HashMap、TreeMap、LinkedHashap的区别与用法
- 区别: vector list deque set map
- c++ list, vector, map, set 区别与用法比较
- UVA 11991 Easy Problem from Rujia Liu(map,vector的使用)
- C++ list, vector, map, set 区别与用法比较
- vector 、map 、iterator 之学习笔记
- 循环删除vector和map中的元素
- STL中map和string, vector 用法详解
- 如何在遍历list,vector,map时删除符合条件的元素
- Java容器类List、ArrayList、Vector及map、HashTable、HashMap分别的区别
- [转载] ArrayList Vector LinkedList 区别与用法 以及对 List,Map,Set 的解析
- C++ STL基本容器string,vector,list,deque,map..[转]
- STL中的常用的vector,map,set,Sort用法
- 3.0新成员 -value,vector,map
- 几种常见容器比较和分析 hashmap, map, vector, list, hash table
- UVA 11991 Easy Problem from Rujia Liu?(vector map)
- gdb 查看vector, list, map 内容
- STL 整理(map、set、vector、list、stack、queue、deque、priority_queue)zhuanzai
- C++ 打印Vector、map