0

below is my code:

//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  

I'm trying to create a multidimensional array with a size determined by the user input. I'm getting an error from Microsoft Visual Studio that says hypo must only contain constant values.

Is it possible to generate an array determined by the user's eSideA and eSideB ?

Thank you.

Raph
  • 103
  • 7
  • Consider using `std::vector>` – Cory Kramer May 02 '18 at 15:08
  • 1
    This code makes no sense, using doubles to size an array? Overwiting input before using it? And the answer to your question is yes and no *at the same time*; there are no runtime sized multidimensional arrays in C++, but there are dozens of ways to fake it. Consider a vector of vectors. – Yakk - Adam Nevraumont May 02 '18 at 15:10
  • 1
    when asking about compiler errors, please quote them verbatim. Even if they are hard to read sometimes, they hold valuable information – 463035818_is_not_an_ai May 02 '18 at 16:44

0 Answers0