When using Visual Studio 2010 to run a console program, you may encounter the phenomenon of the program flashing. This could be due to a setup issue or a code flaw. PHP editor Strawberry will introduce you to the common causes of this problem and detailed solutions. Read on to learn how to resolve this issue and ensure your program runs properly.
First open vs2010 (Visual Studio), and then explain it in three ways:
First method:
Add an input statement at the end of the program, so that it will be Require user input and keep the console existing. The specific code is as shown below: ```python input("Please enter:") ``` The modified code will not change the meaning of the original content, but only adds a user input action at the end of the program.
Second type:
Add the statement at the end of the program: system("pause"); After adding this sentence, the console will display the running results. [Please press any key to continue] will be displayed. The specific code is shown below
Third method:
Modify the project configuration, right-click the project, and select the right-click menu Select properties in the pop-up dialog box, then select [Configuration Properties]-->[Linker]-->[System] in the list on the left side of the pop-up dialog box, and then in the list on the right, select the first item System【Select from the value】Console (/SUBSUSTEM:CONSOLE)【As shown in the figure below
The above is the detailed content of Detailed processing method of console program flashing in vs2010 (Visual Studio). For more information, please follow other related articles on the PHP Chinese website!