How to generate 2D vectors on c++ | SoloLearn: Learn to code for FREE!


How to generate 2D vectors on c++


2/19/2017 2:45:31 PM

Irfan Ullah

4 Answers

New Answer


im gunna write everything assuming that you have using namespace std; if you dont then Everytime before vector. you need std:: creation: vector< vector<dataType> > vectorName; ****the space between > > is Extremely important. filling: you can create single(1-D) vectors. vectorName.push_back(vector1D); but there are Lots of ways accessing: just like a 2D array. you can use vectorName [I][j] to access everything. hope this helps!!


I could post a code if it helps you to visualize it. just let me know :D


vector< vector<int> > vec;


hey i made a code thing. go check it out on my profile. it is called cpp_2DVectorSummaryFunction. i hope it helps!!!!