C语言程序怎么设计日期?

如题所述

数据结构 :

#include <time.h> stringude ring.h> #include<stdio.h> ,/*在<time.h>中定义的结构体类型 struct tm 

设计时间模块列表 :

TodayTime_f(Time *); /*返回当前时间、日期*/ Print_f(Time); /*打印时间 */ Input_f(Time *)  /* 输入时间*/ int IsLeapYear_f(int ); /*判断是否闰年*/ int FindDaysInMonth_f( int nYear,  int nMon); /* 

返回指定月份的天数*/ void AddDay_f(Time *strpTime, int nDay); /* 结构体变量加上天数*/ AddTime_f (Time *strpBas, Time *strpNum);  /*时间相加*/ void TimeAdd_f(); /* 时间相加*/ void Initial(void); /*

初始化信息*/ TodayTime_f(Time *strpTime) { time_t  strCurrTime = time(0);/* 取当前时间*/   struct tm *strpCurr = localtime(&strCurrTime);   strpTime->nDay = strpCurr->tm_mday;   strpTime->nYear = (strpCurr->tm_year+1900);   strpTime->nMon = strpCurr->tm_mon+1;   strpTime->nSec=strpCurr->tm_sec;   strpTime->nMin=strpCurr->tm_min;   strpTime->nHour=strpCurr->tm_hour。

温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网