Tradtional way to iterator is too complex,so I always try to find the easiest way to complete this function.And now I stumbled upon the answer

Newest Effective Way:

 

cout<<"auto"<<endl;
    for (auto i:try0)
    {
        for(auto j:i)
            cout <<j << " ";
        cout << endl;
    }

Traditonal Way:

for(vector<vector<string>>::iterator ite=try0.begin();ite!=try0.end();ite++)
   {
       temp=*ite;
       for(vector<string>::iterator it=temp.begin();it!=temp.end();it++)
       {
           cout<<*it<<endl;
       }
   }
   for (vector<vector<string>>::iterator it = try0.begin(); it != try0.end(); ++it){
        for (int i = 0; i < (*it).size(); ++i)
            cout << (*it)[i] << " " ;
    }
    int i,j;
    cout<<endl;
    for (i = 0; i < try0.size(); i++)
    {
        for(j = 0; j < try0[0].size(); j++)
            cout << try0[i][j] << " ";
        cout << endl;
    }

 

posted on 2019-07-30 11:10  黑暗尽头的超音速炬火  阅读(181)  评论(0编辑  收藏  举报