二维数组 - 表达式必须有常量值错误
2-D Array - Expression must have a constant value error
我正在尝试 Latin Square Daily Challenge on Reddit,我想使用一个在 运行 时间内分配大小的数组,方法是使用以下代码:
int n;
cout << "Please enter the size of the Latin Square: ";
cin >> n;
int latinsquare[n][n];
这适用于在线编译器,但不适用于 Visual Studio 17. 有没有办法在 Microsoft C++ 编译器中执行此操作?
我正在尝试 Latin Square Daily Challenge on Reddit,我想使用一个在 运行 时间内分配大小的数组,方法是使用以下代码:
int n;
cout << "Please enter the size of the Latin Square: ";
cin >> n;
int latinsquare[n][n];
这适用于在线编译器,但不适用于 Visual Studio 17. 有没有办法在 Microsoft C++ 编译器中执行此操作?