Anonymous user
Sleep: Difference between revisions
C
(common lisp implementation) |
(C) |
||
Line 30:
PRINT "Awake!"</qbasic>
"SLEEP" with no argument will sleep until a button is pressed on the keyboard (including modifier keys such as shift or control). Also, pressing a key while SLEEP is waiting for a specific amount of time (as above) will end the SLEEP.
=={{header|C}}==
{{Works with|POSIX}}
The function <tt>sleep</tt> needs seconds, which are read from the standard input.
<c>#include <stdio.h>
#include <unistd.h>
int main()
{
unsigned int seconds;
scanf("%u", &seconds);
printf("Sleeping...\n");
sleep(seconds);
printf("Awake!\n");
return 0;
}</c>
=={{header|C++}}==
|