The main function is the entry point for your application. However, this isn't called directly by the operating system because C++ will perform initialization before main is called. This includes constructing the Standard Library global objects (cin, cout, cerr, clog, and the wide character versions) and there is a whole host of initialization that is performed for the C Runtime Library that underpins C++ libraries. Further, there are the global and static objects that your code creates. When the main function returns, the destructors of global and static objects will have to be called and a clean-up performed on the C runtime.
There are several ways to stop a process deliberately. The simplest is to return from the ...