| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 470 人关注过本帖
标题:求助!关于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
快速回复:求助!关于time。
数据加载中...
 
   



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

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