All pastes #484319 Raw Edit

2D Vectors

public cpp v1 · immutable
·published 2007-05-12 04:12 UTC
rendered paste body
///////////////////////////////////////////////// Created By: Nirucesis// Purpose: To show how to implement 2D vectors///////////////////////////////////////////////#include <iostream>#include <vector>int main(){    std::vector< std::vector<std::string> > Vector_2D;    std::vector< std::string > FlatVector, FlatVector2;    std::vector< std::vector<std::string> >::iterator RowIt;    std::vector< std::string >::iterator ColIt;        FlatVector.push_back("silly"), FlatVector2.push_back("man");    FlatVector.push_back("man"), FlatVector2.push_back("silly");    FlatVector.push_back("rabbit"), FlatVector2.push_back("rabbit");;        Vector_2D.push_back(FlatVector);    Vector_2D.push_back(FlatVector2);        for(RowIt = Vector_2D.begin(); RowIt != Vector_2D.end(); ++RowIt)    {        for(ColIt = RowIt->begin(); ColIt != RowIt->end(); ++ColIt)               std::cout << *ColIt << std::endl;        std::cout << "\n";    }        std::cin.get();    return 0;}