array of struct in C++

#include <iostream>
#include <string>

struct Student {
    int studentID;
    std::string name;
    double grade;
};

int main() {
    const int arraySize = 3;
    Student studentArray[arraySize];

    // Input data for each student
    for (int i = 0; i < arraySize; ++i) {
        std::cout << "Enter details for student " << i + 1 << ":" << std::endl;

        std::cout << "Student ID: ";
        std::cin >> studentArray[i].studentID;

        std::cout << "Name: ";
        std::cin.ignore(); // Ignore the newline character left in the buffer
        std::getline(std::cin, studentArray[i].name);

        std::cout << "Grade: ";
        std::cin >> studentArray[i].grade;

        std::cout << std::endl;
    }

    // Displaying the information
    std::cout << "Student Information:" << std::endl;
    for (int i = 0; i < arraySize; ++i) {
        std::cout << "Student " << i + 1 << " - ID: " << studentArray[i].studentID
                  << ", Name: " << studentArray[i].name
                  << ", Grade: " << studentArray[i].grade << std::endl;
    }

    return 0;
}