Did you ever think about declaring a multi-dimensional array dynamically? If so, I have created a class in C++ just for this.
So the problem goes like this: let an array a of type T, declare an array with n dimensions where n was inputted by the user.
The key is to think about a tree.
Both the implementation and an example can be found here: