When you write a C ++ program in VS, you will find that when you run the program, the console will flash by and you will not see the results of the program. Therefore, you need to find a way to make the screen or console pause.
- method one: increase the input statement at the end of program, this will require the user to input before the end of the program runs, the console will stay there, specific code as shown in the figure below
- The perfect solution of VS2010 console program running in a flash
- Solution to the problem of console flash in vs2017 runtime
- Solution to the flash of visual studio console program output window
- Visual studio 2015 compiler, console flash solution
- Solution to the flash of running result of dev C / C + +
- How to solve the problem that the console window disappears in a flash after visual studio 2017 runs
- Solution to the problem of console output window’s CMD flashing back when vs2015 writes C + + program
- Solve the problem of vscode window console “flash”
- The solution of flashing back after the end of console program running
- Solution to the flash of visual studio 2017 running program
- The problem of flash back by pressing enter window when debugging or executing program in Visual Studio C
- Solution to the problem of Chinese garbled in gradle console in idea
- use cin.get () instead of system (“pause”) to avoid the flash of C + + programs
- How to solve the problem that the output results of C + + program written in VS2010 flash by
- Solution for flash back of vs2015 running interface
- Run with Python console solution is set by default for all projects in pcharm
- VS2010 debugging window flash solution
- Problem solving – vs debugging window flash solution
- Solution to the problem of no C / C + + option in the new project of eclipse
- The reasons and common solutions of vs flash back on the road of C + + Learning (with reasons attached)
alternative Rich two alternatives: in C: printf (” press any key to continue…” );
getchar(); 12 In C++ : Cout<; <" Press any key to continue..." ;
cin.clear();
cin.sync();
cin.get(); 1234 plus cin. The clear (), cin. The sync () these two words, is to empty the cache area, let cin. The get () to receive your real keyboard input method
2: add the statement at the end of the program: system (” pause “); Things to Avoid in C/C++ — system(“pause”) is not recommended because:
is not portable: only for DOS or Windows, not Linux, etc.
consumes system resources: Calling the system command system() to “suspend the program” is overkill.
must add a header file: stdlib.h or cstdlib. There are many header files in C ++ that already contain this file, so it is sometimes possible to use this function without the header stdlib.h, but it is better to add it for safety reasons. 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 on the left of the pop-up dialog box –>; ‘Linker’ –>; “System”, then in the list on the right, in the first “subsystem” value, select “Console” (/SUBSUSTEM:CONSOLE) “as shown in the figure below