The vs2013 code running window flashed by

I used VC++6.0 and C++ in VS to program. After installing it normally today, I wrote a correct program. When it can be run, the DOS window will flash by and it will be compiled normally, but what I don’t understand is why it disappears. so fast?
The dos interface will appear because your program may use functions that need to use dos to display the result (or input, etc.), such as the printf() function, which disappears immediately because you execute the program in one step, and the dos interface is finished for you After what it needs to do, it will be destroyed. If you want to see the whole process clearly, you can set breakpoints, step through it, and see the running process of the program. Check it
on Google and Baidu, and there are these answers:
1) You It should be running a console application. You need to add a pause function before the return 0 at the end of the main code. This function is used to get characters from the standard input and then the program will continue to run. Typically, getchar() can be used in c programs. , getchar() is included in the header file stdio.h. You can also call system("pause"); , which is a Windows cmd command to pause, which is reflected in the console program as the program continues after obtaining any keyboard message, which is included in the c library stdlib.h.

2) In fact, there is a better solution: right-click on your project entry (project), select the last item "property/property" on the pop-up menu, and find "Configuration Properties - >Linker->System", click the "System" item, and configure the value of the engraved item as "Console(/SUBSYSTEM:CONSOLE)" in the "subSystem" in the right column.
After this configuration, press Ctrl+F5 again, and the program will stay in the console interface after running, prompting you to "press any key to continue". So far, the problem is solved perfectly.

3) You can also debug step by step to see the running result by setting breakpoints.

4) Change the operation mode
and open a new cmd.exe window:
C:\> D: //Switch the drive letter
D:\> cd mypath // switch directory
D:\mypath>my.exe //execute program:

PS: This article is the link I forwarded to
http://blog.csdn.net/u014021801/article/details/40826111
The program crashes, I tried the above methods, only system("pause"); , ( It is included in the c library stdlib.h.) It was successful. As for other methods, I haven't figured out why it hasn't improved;
see my program in the next blog.
I changed the main function of void main with no return type to int main has a main function with a return type, and system("pause") is added before the last return0; of course, #include should also be added to the header file

I used VC++6.0 and C++ in VS to program. After installing it normally today, I wrote a correct program. When it can be run, the DOS window will flash by and it will be compiled normally, but what I don’t understand is why it disappears. so fast?
The dos interface will appear because your program may use functions that need to use dos to display the result (or input, etc.), such as the printf() function, which disappears immediately because you execute the program in one step, and the dos interface is finished for you After what it needs to do, it will be destroyed. If you want to see the whole process clearly, you can set breakpoints, step through it, and see the running process of the program. Check it
on Google and Baidu, and there are these answers:
1) You It should be running a console application. You need to add a pause function before the return 0 at the end of the main code. This function is used to get characters from the standard input and then the program will continue to run. Typically, getchar() can be used in c programs. , getchar() is included in the header file stdio.h. You can also call system("pause"); , which is a Windows cmd command to pause, which is reflected in the console program as the program continues after obtaining any keyboard message, which is included in the c library stdlib.h.

2) In fact, there is a better solution: right-click on your project entry (project), select the last item "property/property" on the pop-up menu, and find "Configuration Properties - >Linker->System", click the "System" item, and configure the value of the engraved item as "Console(/SUBSYSTEM:CONSOLE)" in the "subSystem" in the right column.
After this configuration, press Ctrl+F5 again, and the program will stay in the console interface after running, prompting you to "press any key to continue". So far, the problem is solved perfectly.

3) You can also debug step by step to see the running result by setting breakpoints.

4) Change the operation mode
and open a new cmd.exe window:
C:\> D: //Switch the drive letter
D:\> cd mypath // switch directory
D:\mypath>my.exe //execute program:

PS: This article is the link I forwarded to
http://blog.csdn.net/u014021801/article/details/40826111
The program crashes, I tried the above methods, only system("pause"); , ( It is included in the c library stdlib.h.) It was successful. As for other methods, I haven't figured out why it hasn't improved;
see my program in the next blog.
I changed the main function of void main with no return type to int main has a main function with a return type, and system("pause") is added before the last return0; of course, #include should also be added to the header file

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325608707&siteId=291194637