Access to data of array while I have its name as string

The problem is as following.
First, I have 21 arrays named: integer abee1, abee2, ... , abee20 and myarray all with the same dimension of [51][4]. Next, in a loop of 20 circles, I fill myarray with random integers then copy it into abee1-20 (each one per iteration). Then, for each array (abee1-20), I want to calculate sum of all numbers in second column as cost of that array and store it in the a new array called arrayCosts[20][2] ( char arrayName, int arrayCost)- the name of array in the arrayName column and cost of that array into arrayCost column . After that, I want to sort arrayName based on the cost and extract the 3 top array with lowest cost. I know that I should do a search in the array to find these three. Finally, copy these three into 3 new array called elite1, elite2, elite3.
Please help me at least in the main point I do not know what to do.
1- The following code is for making the sting name of abee1-20 in string made in each step of the loop.
    for ( cc = 1 ; cc < 20; cc++)
                {   string String = static_cast<ostringstream*>( &( ostringstream () << cc) )->str();
                    string array_name = "abee" + String;

I want to use array_name (for example in the first loop which array_name is “abee1” ) for reaching the abee1 (which is a filled array) after dong a search in the array called “arrayCosts”. This search retrieves the name of array but it is string and I want to have the array with the same name.
int abee[20] [51][4];
You can't do what you want because C++ is not reflexive; the variable names effectively vanish once the program is running, so even if you could generate them and you would have no way of related a name to some location in memory.

Normally, when you have variables named like the ones you show, consider turning them into an array themselves; so you could have declarations like so:
int abee[20][51][4];
int myarray[51][4];

Topic archived. No new replies allowed.