如何设置时间间隔?
来源:百度知道 编辑:UC知道 时间:2024/09/27 21:22:59
哪位兄弟姐妹知道如何设置
C语言中 for循环 每次循环时间 间隔1秒(产生随机数用)?
麻烦高手告诉下!!!
C语言中 for循环 每次循环时间 间隔1秒(产生随机数用)?
麻烦高手告诉下!!!
用定时器,
#include <sys/time.h>
int getitimer(int which, struct itimerval *value);
int setitimer(int which, const struct itimerval *value,
struct itimerval *ovalue);
#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
for(int i=0;i<10;++i)
{
printf("%d",i);
Sleep(1000);//间隔一秒!!
}
return 1;
}