Accpt array input in single line in cpp

#include <iostream>

int main() {
    const int SIZE = 5; // Define the size of the array
    int arr[SIZE];      // Declare an array of integers with the specified size

    // Accept array input in a single line
    std::cout << "Enter " << SIZE << " integers separated by spaces: ";
    for (int i = 0; i < SIZE; ++i) {
        std::cin >> arr[i]; // Read each integer from the input stream and store it in the array
    }

    // Display the entered array elements
    std::cout << "Entered array: ";
    for (int i = 0; i < SIZE; ++i) {
        std::cout << arr[i] << " "; // Print each element of the array
    }

    return 0;
}