I had read somewhere that C++ requires the size of all statically allocated arrays to be known at compile time. If that information is not known beforehand you either use a pointer (along with dynamic memory allocation) or you use a vector.
I am quite surprised that the following code works perfectly, even though it uses a statically allocated array whose size is not known until runtime.
#include <iostream>
#include <string>
using namespace std;
int main() {
int input;
cout << "Enter input: " << endl;
cin >> input;
int dimension = input + 4;
int array[dimension];
for (int i = 0; i < dimension; i++)
array[i] = i;
for(int i = 0; i < dimension; i++)
cout << array[i] << " ";
cout << endl;
return 0;
}