http://www.cplusplus.com/reference/clibrary/ctime/clock.html
/* clock example: countdown */ #include <stdio.h> #include <time.h> void wait ( int seconds ) { clock_t endwait; endwait = clock () + seconds * CLOCKS_PER_SEC ; while (clock() < endwait) {} } int main () { int n; printf ("Starting countdown...\n"); for (n=10; n>0; n--) { printf ("%d\n",n); wait (1); } printf ("FIRE!!!\n"); return 0; }
'Papers > programming' 카테고리의 다른 글
double pointer memory allocation (0) | 2008.01.21 |
---|---|
[C++] std::list find (0) | 2007.12.06 |
simple makefile with macro definition (0) | 2007.11.03 |
type casting[읽는중] (0) | 2007.10.24 |
polymorphism (0) | 2007.09.29 |