In c++ programs, if it is a window, sometimes a flash will disappear. If you do not want it to disappear, add:
system(“pause”);
note: do not add after the return statement, it will not be executed.
analysis:
System () is a call to (DOS) system commands (and shell commands).
pause, the pause command in the DOS command collection;
when a program writes a system(“pause”) statement, it calls the “pause” command from the program. When the program runs to this statement, it displays “Press any key to continue…” in the program window. Wait for the user to press any key to return the program from the paused state to the execution state to resume execution from where it was suspended.
void system(char * CMD);
parameter CMD, DOS command, such as Pause, CLS
return value: none.
VC 6.0, to add the following header file!
#include < stdlib.h>
Use examples:
#include < stdio.h>
int main()
{
Printf (” First pause during execution of this process! \ n “)
system(“Pause”);
Printf (” Second pause in the execution of this process! \ n “)
system(“Pause”);
return 0;
}
===============================================
What does system(“pause”) mean in C
System is a call to call system commands (and shell commands) from a program.
System (“pause”) calls the “pause” command from a program;
The system command “pause” simply prints a line of words like “Press any key to exit” on the command line, waits for the user to Press a key, and returns.
C++ suspends black window system(” pause “);
In c++ programs, if it is a window, it sometimes flashes away. If you do not want it to disappear, add:
system(“pause”) at the end of the program.
note: do not add after the return statement, it will not be executed.
analysis:
system() is to call the system command;
pause pause command;
so that when run here, it will show “Press any key to continue..” that is, “Press any key to continue…” ;
in VC 6.0, to add the following header file!
#include < stdlib.h>
system(“Pause”)
System (“Pause”) means that the DOS command Pause is called directly.
void system(char * CMD);
parameter CMD, DOS command, such as Pause, CLS
return value: none.
use:
#include < stdio.h>
int main()
{
system(“Pause”);
return 0;
}