vector<vector<string>> 二维向量遍历输出

在编程中经常使用二维向量组成的数组,有时候就需要遍历输出,想了下面的方式,可以得到遍历结果

    #include<stdio.h>
    #include<vector>
    #include<string>
    #include <iostream>
    using namespace std;
    vector<string> temp_vect;
    // vect是vector<vector<string>>类型的值
    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 << endl;
    }

参考链接:https://blog.csdn.net/pingxu1987/article/details/18665631

posted on 2022-11-24 14:13  健力宝1995  阅读(161)  评论(0编辑  收藏  举报

导航