The solution to the black window flash of running program on Visual Studio Append system (“pause”) at the end of the main function; Having a return 0 statement; Just write a line above the return statement.