#include <iostream>
#include <string>
#include <cstring>
#include <ctime>
void wait(double seconds);
using namespace std;
int main()
{
int i = 0;
while (i<10)
{
cout << "start coutdown..." << i << " seconds!" << endl;;
wait(i);
i++;
}
cout << "Done! an";
return 0;
}
void wait(double seconds)
{
clock_t delay = seconds * CLOCKS_PER_SEC; //转化为延时的秒数
clock_t start = clock(); //获取当前的时间
while(clock()-start < delay) //比较时间是否在限定的延迟之内
;
}
最后
以上就是悦耳帆布鞋最近收集整理的关于在C++中延时的全部内容,更多相关在C++中延时内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复