/*calculate time*/
#include "time.h"
#include "stdio.h"
main()
{ time_t start,end;
int i;
start=time(NULL);
for(i=0;i<3000;i++)
{ printf("\1\1\1\1\1\1\1\1\1\1\n");}
end=time(NULL);
printf("\1: The different is %6.3f\n",difftime(end,start));
}
------------------------------------------------------------------------------
http://www.zhiyin.cn/ylzx/gzpx/5467249401.html
http://www.zznews.cn/hyzx/jkxx/5470498705.html
-----------------------------------------------------------------------------
【程序93】
题目:时间函数举例3
1.程序分析:
2.程序源代码:
/*calculate time*/
#include "time.h"
#include "stdio.h"
main()
{ clock_t start,end;
int i;
double var;
start=clock();
for(i=0;i<10000;i++)
{ printf("\1\1\1\1\1\1\1\1\1\1\n");}
end=clock();
printf("\1: The different is %6.3f\n",(double)(end-start));
}
-----------------------------------------------------------------------------
C语言时间函数示例
本文提供两个使用C语言的时间函数示例程序,通过计算打印操作所耗费的时间来展示time()与clock()函数的应用。第一个程序利用time()函数计算3000次打印操作耗时,第二个程序则用clock()函数计算10000次打印操作耗时。
8661

被折叠的 条评论
为什么被折叠?



