I have a loop that performs calculations and fills an array
double d_SPerpendicularT[j]
I want to store this array with a systematic name, run the loop again to calculate a new d_SPerpendicularT[j] and store it with a new name and so on.
I'm doing this so that later I can write line 'j' from every array to a corresponding line in one big file.
I'm stuck making a new variable name in the loop and then attaching the value of d_SPerpendicularT[j] to it.
What I've tried to do is make a new string where the name changes every time the loop runs, but then I don't know how to use this string as a variable name to set equal to an array of numbers.
Here's what it looks like:
Code:
s_VariablePerp.Format("s_%i%c%i_perp",dig1,letter1,dig2);
//which makes a string that looks like s_0q0_perp, where 0q0 changes depending on the values used during in the loop
//The following line doesn't work but basically what i want to do is use the string associated with s_VariablePerp as a variable name
double s_VariablePerp[1000];
//then i want to write to my new variable name
for (int j = 1; j <= i_Angles; j++)
{
s_VariablePerp[j] = d_SPerpendicularT[j];
}
Also let me know if I'm going about this entirely wrong or if you think there could be an easier way.
thanks
keendoc