I am trying to build a multidimensiona l vector array that allows for multiple child elements under each parent element, but I am having a heck of a time trying to figure out how to do it.
Right now with the code posted below. I get this type of output.
But this is more along the lines of what I am trying to accomplish.
Everything I have tried doesn't end with this result. So I am at a bit of a loss as what I am doing wrong.
Here is my current code implementation (the child array elements have been removed so I could test some other ideas). Any help with this is greatly appreciated.
Right now with the code posted below. I get this type of output.
Code:
Resource : 0 Resource : 1 Resource : 2
Code:
Resource : 0 Class: 0 Class: 1 Resource : 1 Class: 0 Class: 1 Resource : 2 Class: 0 Class: 1
Here is my current code implementation (the child array elements have been removed so I could test some other ideas). Any help with this is greatly appreciated.
Code:
vector< vector<int> > vec; for (int i = 0; i < 3; i++) { vector<int> row; row.push_back(i); vec.push_back(row); } for(int k = 0; k < vec.size(); k++){ for(int l = 0; l < vec[k].size(); l++){ cout << "Resource : " << vec[k][l] << endl; } }
Comment