#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int i;
time_t start, stop;
double duration;
start = clock();
long long sum=0;
for(int i=0;i<1e2;i++){
sum=sum+i;
printf("%d,%lld\n",i+1,sum);
}
stop = clock();
duration = ((double)(stop - start))/CLOCKS_PER_SEC;
printf("\n duration = %f,%f\n",duration,CLOCKS_PER_SEC);
return 0;
}
C使用clock计算代码执行时间
猜你喜欢
转载自blog.csdn.net/lzdelphi/article/details/104620988
今日推荐
周排行