0
How to generate 2D vectors on c++
4 ответов
+ 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!!
+ 1
I could post a code if it helps you to visualize it. just let me know :D
+ 1
vector< vector<int> > vec;
+ 1
hey i made a code thing. go check it out on my profile. it is called cpp_2DVectorSummaryFunction. i hope it helps!!!!