Quote Originally Posted by Eri523
The reason why I have started a thread about that marginal topic at all is: This way of doing that is so common that I started to ask myself whether there might be some common source that teaches them to do so.
There might have been a single source at one point, but now I believe this has found its way to examples in many different tutorials and books, so there is no common source.

Quote Originally Posted by monarch_dodra
Because when you teach a student the "hello world" program under windows, and you want to make sure the shell doesn't close so they can see the window, what are you going do to?
If I have control over the development environment, I would either provide the student with an IDE that is configured to pause the console window at the end, or have the student open a separate console window. If I only have control over the material, then I might prepare a function for the student to use, e.g.,
Code:
void pause()
{
    using namespace std;
    cout << "Press enter to continue...";
    cin.clear();
    cin.ignore(10000, '\n');
    cin.get();
}
with instructions to write pause(); at the end of the global main function should the student face the problem of the console window closing prematurely. An advantage here is that my material would then be applicable even if such a command was not available, or not named pause.