C++ press enter to continue function

#include <iostream>

void pressEnterToContinue() {
    std::cout << "Press Enter to continue...";
    std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}

int main() {
    // Your main program logic here

    pressEnterToContinue(); // Call the function to pause and wait for Enter key press

    // Continue with the rest of your program logic

    return 0;
}