Because the program statement is executed sentence by sentence, nothing makes it pause, at the speed of computer execution, of course, flash by.
What we need to do is make the system wait and pause so that it doesn’t flash back (some compilers automatically add this feature at the end of the code to prevent novice users from seeing the output).
1) add system(“pause”) before return;
Note: system() is the call to the system command; Pause command; “Press any key to continue..”
Note: getchar reads the next character, so it “pauses” while waiting for us to type.
It’s worth noting that sometimes you might need to add two getchar(), because the first getchar() might eat the carriage return or something like that.
3) Press Ctrl +F5 to run
Note: Ctrl +F5 is a program that debugs without debugging. It automatically “pauses” at the end of the program, so the DOS command prompt “Press any key to continue….” is added.
The little triangle we clicked on, which starts debugging (F5), does not automatically add “pause”, so it will flash past.
The above is only the idea after I consult the data to think, welcome everyone fellow middlemen to give correct, next will be very grateful!
- Solution to the flash of visual studio console program output window
- Flashback problem of output window of visual studio 2017 console program
- Solution to the problem of console flash in vs2017 runtime
- C + + uses system (“pause”) to pause black windows
- Solution of vs program flashback problem
- Causes and solutions of black frame flashback after debugging visual studio 2017
- The problem of window flash after C + + program is compiled and run
- use cin.get () instead of system (“pause”) to avoid the flash of C + + programs
- The solution of flashing back after the end of console program running
- C + + pauses the black window system (“pause”); (get ch(), getchar(), system (pause)’s connection and difference
- Solution of command line window flashback when visual studio runs C + + program
- Solution to the flash of running result of dev C / C + +
- Two lines of code to solve your vs flashback problem
- Some solutions to the problem of windows flashback after vs running
- VS2010 debugging window flash solution
- Flash back after vs compiler running, processing method
- Visual studio console program output window flashed by
- Problem solving – vs debugging window flash solution
- Visual studio 2012, a complete collection of solutions to flash back windows after running
- Solve the problem of flash back in VS2010