zl程序教程

您现在的位置是:首页 >  其它

当前栏目

自定义的delay函数

函数 自定义 delay
2023-06-13 09:11:57 时间

大家好,又见面了,我是你们的朋友全栈君。

#include <time.h>

#include <stdio.h>

void wait ( int m_seconds )

{

clock_t endwait;

endwait = clock () + m_seconds ;

while (clock() < endwait) {}

}

// VC下clock_t应为double

int main(void)

{

clock_t start, end;

start = clock();

wait(3000);

end = clock();

printf(“The time was: %f/n”, (end – start) / CLK_TCK);

return 0;

}

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/137057.html原文链接:https://javaforall.cn