When writing C/C ++ programs in VS, the result box will always flash away, and you can’t see the results of the program. This is really annoying, so here are three ways to solve it
Method one:
In the return 0; Before the statement, add a getchar(); In this case, getchar will wait for input, and the result box will display the result of the program.
As shown in the figure below:


Method 2:
Add the statement system(“pause”) at the end of the program; , plus the header file #include< stdlib.h> “, which will display the results after running them and prompt you to press any key to continue.
As shown in the figure below


Method 3:
To modify the project configuration, right-click on the project, select Properties from the right-click menu, and then select “Configuration Properties –>” from the list to the left of the pop-up dialog. The linker – & gt; System “, and then in the list on the right, in the first “subsystem” value, select “Console (/SUBSUSTEM:CONSOLE)”
As shown in the figure below:



From:
https://blog.csdn.net/rannianzhixia/article/details/66968219?locationNum=6& fps=1
Method one:
In the return 0; Before the statement, add a getchar(); In this case, getchar will wait for input, and the result box will display the result of the program.
As shown in the figure below:


Method 2:
Add the statement system(“pause”) at the end of the program; , plus the header file #include< stdlib.h> “, which will display the results after running them and prompt you to press any key to continue.
As shown in the figure below


Method 3:
To modify the project configuration, right-click on the project, select Properties from the right-click menu, and then select “Configuration Properties –>” from the list to the left of the pop-up dialog. The linker – & gt; System “, and then in the list on the right, in the first “subsystem” value, select “Console (/SUBSUSTEM:CONSOLE)”
As shown in the figure below:



From:
https://blog.csdn.net/rannianzhixia/article/details/66968219?locationNum=6& fps=1