GCC and by extension MingW allows you to declare a function as a destructor to the program as a whole. This is by far my favorite method as it pauses your program at the end without you having to enter anything AND does not prevent you from calling the same function at anytime in your code. Here is my method:
1 2 3 4 5 6 7
void pause() __attribute__((destructor)); /* Function Declaration, You Cannot Declare Attributes Without This */
std::cin.sync(); // Flush The Input Buffer Just In Case
std::cin.ignore(); // There's No Need To Actually Store The Users Input
EDIT: I've been digging around MSDN for a while now to find a way to do this with CL (That is M$'s compiler), but haven't found anything yet because it's not my main compiler. If anyone knows of a way to do this PLEASE let me know.