std::cout << "Enter the size of the array: "; std::cin >> size; int arr[size]; std::cout << "Enter " << size << " elements for the array:\n"; for (int i = 0; i < size; i++) { std::cout << "Element " << i+1 << ": "; std::cin >> arr[i]; } std::cout << "The array has been filled with the following elements:\n"; for (int i = 0; i < size; i++) { std::cout << arr[i] << " "; } return 0;
int main() {
std::cout << "Enter the size of the array: ";int size;
std::cin >> size;
int arr[size];
std::cout << "Enter " << size << " elements for the array:\n";
for (int i = 0; i < size; i++) {
std::cout << "Element " << i+1 << ": ";
std::cin >> arr[i];
}
std::cout << "The array has been filled with the following elements:\n";
for (int i = 0; i < size; i++) {
std::cout << arr[i] << " ";
}
return 0;
}