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

C语言程序怎么设计日期?,第1张

数据结构 :

#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。

你试前嫌冲试下面的慧歼程序:

#include

#include

#include

int

main()

{

clock_t

start,

finish

double

elapsed_time

start=clock()

//do

sonething

...

finish=clock()

elapsed_time

=

finish-start

}

我在vc++

6.0下运行,可以得到以毫秒为单者搭位的计时


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8279274.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-14
下一篇 2023-04-14

发表评论

登录后才能评论

评论列表(0条)

保存