| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2156 人关注过本帖
标题:一个简单的计算年龄的问题,请各位指点
取消只看楼主 加入收藏
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
快速回复:一个简单的计算年龄的问题,请各位指点
数据加载中...
 
   



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

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