vector<vector<string>> 二维向量遍历输出
2014-01-22 16:35
369 查看
在编程中经常使用二维向量组成的数组,有时候就需要遍历输出,想了下面的方式,可以得到遍历结果
vector<string> temp_vect;
for (vector<vector<string>>::iterator ite = vect.begin(); ite != vect.end(); ite++)
{
temp_vect = *ite;
for (vector<string>::iterator itee = temp_vect.begin(); itee != temp_vect.end(); itee++)
cout << *itee;
cout << endl;
}
vector<string> temp_vect;
for (vector<vector<string>>::iterator ite = vect.begin(); ite != vect.end(); ite++)
{
temp_vect = *ite;
for (vector<string>::iterator itee = temp_vect.begin(); itee != temp_vect.end(); itee++)
cout << *itee;
cout << endl;
}
相关文章推荐
- 二维向量:vector<vector<int>>
- 遍历Map<String, String>的方法, 输出map里所有的<k, v>
- jsp遍历List<Map<String,Object>>,输出<Map<String,Objectr>>
- STL的vector<string>的初始化方式总结
- vector<string>
- 将List<Map<String, Object>>遍历后存入List<Object<String,String,List<Map<String, String>>>中>
- List<Map<String, String>>遍历相同数据合并(map里面某个key相同则合并数据)
- c++ std::sort用法详细(对std::vector<int>, 对std::vector<std::string>, std::vector<char>等等)
- C++文本查询程序 定义类管理数据 用智能指针 用StrBlob代替vector<string> C++Primer 练习12.32
- Java学习笔记(八):Map<stirng,string>的遍历的四种方法
- List<Map<String,Object>> list 在java代码和jsp中的遍历
- jstl 遍历 List<Hashtable<String,String>>
- Struts2标签遍历List<Map<String,String>>
- C++文本查询程序 定义类管理数据 用智能指针 用StrBlob代替vector<string> C++Primer 练习12.32
- List<Map<String,Object>>如何使用Java代码遍历以获取String,Object的值
- 迭代输出Map和List<Map<String,Object>>的方法
- 将List<Map<String,String>>中的数据输出保存到TXT文本文件中
- HasMap中添加List<String>遍历输出结果不对
- Map.Entry<String,String>,map.entrySet()遍历HashMap,HashTable
- std::vector<string>的find();与erase();