Question : How do I create multi-dimensional arrays in C++?

Ok in VB6 I used to create multi-dimensional arrays of varying lengths, can I do this in C++?

Let me give an example.  Say we have 8 kids engaged in trading baseball cards.  Each kid possesses a different number of cards of varying values.  In VB6 I could create an array with 8 elements, one for each kid, and each of the 8 elements could have an array containing a varying number of elements describing the baseball cards that the individual kid owned (price, condition, etc)...see what I mean?  It wasn't necessarily an 8x8 multidimensional array.

It could be something like 1(32), then 2(3), then 3(12), then 4(32), then 5(5), then 6(17), then 7(138), and last 8(99).  Kid #7 was a lucky kid with a lot of baseball cards (138).

Can I do this in C++?

Answer : How do I create multi-dimensional arrays in C++?

>>i already have a vector of structs such that the struct contains the kid
>>owner's name, baseball player name, and value of the card.  now, i want to
>>assign the cards to the kids that own them.

Well, in that case it would be like
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
struct Data {

  string owner;
  string player;
  double value;
};

vector<Data> kid1;
vector<Data> kid2;
vector<Data> kid4;

vector<vector<Data> > KidArray;

KidArray.push_back(kid1);
KidArray.push_back(kid2);
KidArray.push_back(kid3);
Random Solutions  
 
programming4us programming4us