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
alternative Rich two alternatives: in C: printf (” press any key to continue…” );
getchar(); 12 In C++ : Cout<; <" Press any key to continue..." ;
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
- Three solutions to flash back of program running result box under vs
- Solution to the flash of visual studio 2017 running program
- The solution of flashing back after the end of console program running
- How to solve the problem that the console window disappears in a flash after visual studio 2017 runs
- Flashback problem of output window of visual studio 2017 console program
- Solution to the flash of visual studio console program output window
- Solution to the flashback of visual studio output window
- Why does the result screen flash when visual studio runs the program?
- Three methods of how to remove the flashback of running result box in VS
- The perfect solution of VS2010 console program running in a flash
- Some solutions to the problem of windows flashback after vs running
- Solution of vs program flashback problem
- Problem solving – vs debugging window flash solution
- Solution to flash back of visual studio 2017 running program
- [vs console program flashback]
- Vs output flashback
- C + + pauses the black window system (“pause”); (get ch(), getchar(), system (pause)’s connection and difference
- Solution for flash back of vs2015 running interface
- Three solutions to command line flashback in VS
- Solution to the flash of running result of dev C / C + +