0

How to generate 2D vectors on c++

19th Feb 2017, 2:45 PM
Irfan Ullah
Irfan Ullah - avatar
4 Réponses
+ 3
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!!
19th Feb 2017, 4:06 PM
Michael Szczepanski
Michael Szczepanski - avatar
+ 1
I could post a code if it helps you to visualize it. just let me know :D
19th Feb 2017, 4:14 PM
Michael Szczepanski
Michael Szczepanski - avatar
+ 1
vector< vector<int> > vec;
19th Feb 2017, 4:14 PM
Robobrine
Robobrine - avatar
+ 1
hey i made a code thing. go check it out on my profile. it is called cpp_2DVectorSummaryFunction. i hope it helps!!!!
19th Feb 2017, 8:27 PM
Michael Szczepanski
Michael Szczepanski - avatar