标题:一个简单的计算年龄的问题,请各位指点
取消只看楼主
bylmyy
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2004-11-23
 问题点数:0 回复次数:2 
一个简单的计算年龄的问题,请各位指点
输入你的生日,然后计算出你从出生到现在一共多少天了?用C库里的时间函数

[此贴子已经被作者于2004-11-24 08:03:06编辑过]


搜索更多相关主题的帖子: 年龄 生日 库里 函数 
2004-11-24 00:00
bylmyy
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2004-11-23
得分:0 
differtime()这个函数是不是计算时间差的?可是我不太会用.大家探究研究.
2004-11-25 20:33
bylmyy
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2004-11-23
得分:0 

大家看看这个程序

#include<time.h> main() { int year,month,date;//你的生日 struct date yourbirthd, nowd; struct tm yourbirtht, nowt; long yourbrith,now; double resultt; long result; .....;//输入你的生日 getdate(nowd); gettime(nowt); yourbirthd->da_year=year; yourbirthd_>da_day=date; yourbirthd_>da_mon=month; yourbirth=dostounix(yourbirthd,yourbirtht); now=dostounix(nowd,nowt); resultt=difftime(yourbirth, now); result=resultt/(24*60*60); ....//输出result即可 }

2004-11-25 22:23



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




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

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