Arturito.net

Come to The Dark Side, We Have Cookies!

C++ Delay Function

without comments

#include

void delay(int n)
{
clock_t start_time, cur_time; start_time = clock();    while((clock() - start_time) < n * CLOCKS_PER_SEC)
{}
}

int main()
{
// do something
delay(5);
// delays 5 seconds
}

Written by guru

March 24th, 2009 at 9:38 pm

Posted in C++