I habitually deal with this problem in three ways
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — –
1, system (” pause “);
2, getchar ();
3, Ctrl + F5
Let’s discuss the pros and cons of each separately: Welcome to the land of the Kings
System (” pause “) : need to include the preprocessing header #include< stdlib.h> ||#include< windows.h>
Usage: put return (); Before the return statement, otherwise there is no meaning
Advantages: solve the flashback problem, small side effects
Disadvantages: call system function, large memory overhead
Getchar () :
Usage: put return (); Before the return statement, otherwise there is no meaning
Advantages: low overhead, receive a character to end the program
Cons: Use it on a case-by-case basis, because getchar (); You need to accept a string to represent the end, and some functions explicitly need to accept a string as the return value, if you use getchar (); To solve the flashback problem, which can be confusing and introduce errors when the program is running.
can see, although can solve the running results of the flashback problem, but in the processing is completely different, although in the operation is also approximately the same, but in the memory, CPU and other levels, overhead is sometimes different, so you can choose according to your preferences for a way for you !!!!! System (” pause “) is recommended; This way, the introduction and processing of files is also more careful, if there is a heavy use of system functionality is, of course. windows.h> #include< stdlib.h> Of course, it is suitable for those who use a lot of library functions
Read More:
- Three solutions to flash back of program running result box under vs
- Solution for flash back of vs2015 running interface
- Solve the problem of flash back in VS2010
- Visual studio 2012, a complete collection of solutions to flash back windows after running
- C language program running results flash back how to do
- Flash back problem of Python running
- 2、 Solutions to the problem of flash back in vs2017
- The reasons and common solutions of vs flash back on the road of C + + Learning (with reasons attached)
- Flash back record of vs2017 installation process
- Flash back of running program in Visual Studio 2017
- Make DOS window wait and not flash back in VS
- Solution to flash back of visual studio 2017 running program
- The perfect solution of VS2010 console program running in a flash
- The problem of running result window flash of vs2015
- Solve the problem of flash back in Visual Studio 2010
- VS2010 debugging window flash solution
- Flash back when compiling Visual Studio
- The problem of flash back by pressing enter window when debugging or executing program in Visual Studio C
- Solution for iPhone wechat flash back with mysterious code
- The solution of flashing back after the end of console program running