Are you using ANSI C++?
For the arrays you can use the split function to create them which will make the size dynamic. Split by linebreak. Lets call this guy array1[].
Next cycle through the data using a for loop. Add array[0] to another array, lets call him dataArray[array[0]][array.Length-1]
Code:
// Using .NET code, convert to whatever - this is just for logic
for (int i=1;i<array.Length;i++) {
dataArray[array[0]][i] = array[i];
}
For the names only create another array and use a function to determine if the value of array[i] is a integer. If not, copy to the function.