下载此文档

时间函数举例.doc


文档分类:高等教育 | 页数:约10页 举报非法文档有奖
1/10
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/10 下载此文档
文档列表 文档介绍
题目:时间函数举例
:
:
#include ""
#include ""
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
:
:
/*calculate time*/
#include ""
#include ""
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 %\n",difftime(end,start));
}
【程序93】
题目:时间函数举例3
:
:
/*calculate time*/
#include ""
#include ""
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 %\n",(double)(end-start));
}
【程序94】
题目:时间函数举例4,一个猜数游戏,判断一个人反应快慢。(版主初学时编的)
:
:
#include ""
#include ""
#include ""
main()
{
char c;
clock_t start,end;
time_t a,b;
double var;
int i,guess;
srand(time(NULL));
printf("do you want to play it.('y' or 'n') \n");
loop:
while((c=getchar())=='y')
{
i=rand()%100;
printf("\nplease input number you guess:\n");
start=clock();
a=time(NULL);
scanf(

时间函数举例 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数10
  • 收藏数0 收藏
  • 顶次数0
  • 上传人zbfc1172
  • 文件大小32 KB
  • 时间2018-06-25