Introduction:
Function Name: Sleep
Function: the execution is suspended for a period of time.
Usage: Unsigned sleep (unsigned seconds );
Use the header file in VC
# Include <windows. h>
In the GCC compiler, the header file used varies with the GCC version.
Header file to be added in Linux # include <unistd. h>
Note:
:
The first English character in sleep in VC is uppercase "S"
In standard C, sleep is used. Do not use uppercase letters. The following uses uppercase letters to describe how to use sleep. In short, sleep is used for VC and sleep is used for other purposes.
The general form of sleep functions:
Sleep (unisgned long );
The Unit in sleep () is millisecond, so if you want to keep the function for 1 second, it should be sleep (1000 );
In Linux, "S" in sleep is not capitalized.
Sleep () is measured in seconds rather than milliseconds.
In Linux, compile with G ++ and add the unistd. h header file. You can add the GCC file without adding it, because the standard C contains the Sleep file.
Example
# Include <windows. h>
Int main ()
{
Int;
A = 1000;
Sleep (a);/* VC uses sleep */
Return 0;
}