标题:求助!关于time。
只看楼主
kalahara
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-6-4
 问题点数:0 回复次数:2 
求助!关于time。

1:

#include <time.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>

int main()
{
time_t first, second;
clrscr();
first=time(NULL);
delay(2000);
second=time(NULL);
printf("The difference is: %f seconds",difftime(second,first));
getch();
return 0;

}

2:

#include <time.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>

int main()
{
time_t first;
getch();
return 0;

}

1和2的运行结果都是:Current time is : ......(当前时间)
Enter new time:

怎么会一样的结果?好像就没执行/*clrscr();
first=time(NULL);
delay(2000);
second=time(NULL);
printf("The difference is: %f seconds",difftime(second,first));
*/段语句似的。

请教高手指点,谢谢。


搜索更多相关主题的帖子: time 
2007-06-04 10:45
I喜欢c
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:64
帖 子:1749
专家分:0
注 册:2007-3-2
得分:0 
可能是运行时间很短..

把 delay(2000) 改大点试试..

 我是指针,却丢失了目标地址!          我是循环,却缺少了结束条件!      我是函数,却没有人来调用!   
2007-06-04 15:29
kalahara
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-6-4
得分:0 

没用。
它就是/*printf("The difference is: %f seconds",difftime(second,first));*/语句也没输出出来。
只停留在 Current time is : ......(当前时间)
Enter new time:
这个位置。

2007-06-05 09:22



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-144709-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.889513 second(s), 9 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved