I recently started programming in C++, I have quite some experience in JAVA programming but I am facing a rather unclear situations whilst trying to initialize multi dimensional arrays in c++.
The code I would use in java would be something like:
int x = 5;
int y = 10;
int array [][] = new int[x][y];
which works fine, I could assign any value to x and y using a scanner or option pane. However (and please bear with me, I am quite new to c++) in c++ I am required to use constants which prevent me from using for example:
int x;
cin >> x;
int y;
cin >> y;
int array [][] = new int[x][y];
I am trying to make a random map generator, eventually i will assign 3d object to positions within the array and design an algorithm to sort all of the objects. However I want the user to be able to specify the size of the grid, specify x and y, the rows and columns.
Any help would be greatly appreciated!
Many thanks in advance.