Standard C++ allow only arrays which size is known at the compile time: you can do something like int a[10]; or constint n = 10; int a[n]; but not int n; cin >> n; int a[n];
You should use either standard automatic containers or allocate memory yourself: int* a = newint[n];
Do not forget to deallocate array when you done with it: delete[] a;