C ++中用户输入double值的多维数组的大小

时间:2018-05-02 15:06:11

标签: c++ arrays multidimensional-array

下面是我的代码:

//variables
double sSideA,sSideB;
double incrementA,incrementB;
double eSideA,eSideB;

//obtain user input
cout << "Please enter the starting value of side A: ";
cin >> sSideA;

cout << "Please enter the end value of side A: ";
cin >> eSideA;

cout << "Please enter the increment value of side A: ";
cin >> incrementA;

cout << "Please enter the starting value of side B: ";
cin >> sSideB;

cout << "Please enter the end value of side B: ";
cin >> eSideB;

double hypo[eSideA][eSideB]; //initialize multidimensional array  

我正在尝试创建一个多维数组,其大小由用户输入决定。我从Microsoft Visual Studio收到错误,指出hypo必须只包含常量值。

是否可以生成由用户的eSideAeSideB确定的数组?

谢谢。

0 个答案:

没有答案