There are several collection types available in the C++ Standard Template Library, one of which std::vector<> will work just fine.
However if you want to use an array with straightforward array mechanics and syntax then an alternative would be to create your own array as in:
#include <iostream>
#include <memory>
int main() {
int first_line;
std::cin >> first_line;
int *second = new int[first_line]; // create an array, must manage pointer ourselves
// read in the element values
for (int i = 0; i < first_line; i++)
std::cin >> second[i];
// write out the element values with spaces as separators
for (int i = 0; i < first_line; i++)
std::cout << second[i] << " ";
delete [] second; // delete the array as no longer needed.
return 0;
}
Using std::unique_ptr<> to contain the pointer to the array would be more convenient and safer and just as easy to use. Create the array with std::unique_ptr<int[]> second( new int[first_line]); and then remove the no longer needed delete[]. std::unique_ptr[] will take care of deleting the array once it goes out of scope.