getch()
causes your program to wait for user input before it terminates. An irritating thing with Win32 console applications is that the console closes as soon as the program terminates (hence why it just flashes).
This was not the case with the old DOS programs under Win9x (where the console would stay open by default, unless a checkbox was selected in the DOS shortcut properties).
If you run both versions of your program in a Command Prompt, you will see that the second one only returns to the prompt after you've pressed a key.