经典C语言程序设计100例(9)

文章作者 100test 发表时间 2007:03:10 17:18:17
来源 100Test.Com百考试题网


【程序91】
题目:时间函数举例1
1.程序分析:
2.程序源代码:
#include "stdio.h"
#include "time.h"
void main()
{ time_t lt. /*define a longint time varible*/
lt=time(NULL)./*system time and date*/
printf(ctime(<)). /*english format output*/
printf(asctime(localtime(<)))./*tranfer to tm*/
printf(asctime(gmtime(<))). /*tranfer to Greenwich time*/
}
-----------------------------------------------------------------------------
【程序92】
题目:时间函数举例2
1.程序分析:           
2.程序源代码:
/*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)).
}
-----------------------------------------------------------------------------
【程序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)).
}

相关文章


计算机等级考试二级上机改错题详细分析1
天津:计算机等级考试昨报名
经典C语言程序设计100例(9)
经典C语言程序设计100例(8)
沈阳:今年下半年全国英语、计算机等级考试时间确定
北京:2003年下半年全国计算机等级考试招考简章
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛