


下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、這是當時我做的一個小小的課題,希望對你有所幫助#includestdio.h/*RequiredforMS-DOSuse#define ENTER0 x1C0D/* Enter key*/int year, month, day;staticchar*days8=,Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday;struct TIMEDATE intyear;/*year1980.2099*/ intmonth;/*month1=Jan2=Feb,day;/*dayofmonth0.31*/inthours;/*h
2、our0.23*/int minutes; /*minute0.59*/intseconds;/*second0.59inthsecs;/*1/100thsofsecond0.99*/ chardateline47;/*date&timetogether*/;static struct TIMEDATE today; main()char cmonth3; char cday3; char cyear5; double getdays();double daynumb, numbnow; intweekday,retcode,dayer,dayer = datetime(&today); cl
3、rscn();for (i=0;i3;+i)cmonthi=0; for (i=0;i3;+i)cdayi=0; for (i=0;i0)printf(nn%02d-%02d-%dwas,month,day,if (numbnow - daynumb 0)printf(nn%02d-%02d-%dwillbe,month,day,printf( a%sn,daysweekday);/* end MAIN */* GETDAYS-Fromintegervaluesofyear(YYYY),month*(MM)andday(DD)thissubroutinereturnsa*double floa
4、t number which represents the*number of days since Jan 1, 1980 (day 1).*This routine is the opposite of GETDATE.*/ double getdays(year, month, day)int year, month, day;int y,m;double a,b,d, daynumb; double floor(),intg();/* make correction for no year 0 */ if (year 0) y = year + 1;else y = year;/* J
5、an and Feb are months 13 and 14 in this calculation */ m = month;if (month 3)m = m + 12;y = y - 1;/* calculate Julian days */d = floor(365.25 * y) + intg(30.6001 * (m + 1) + day - 723244.0;/* use Julian calendar if before Oct 5, 1582 */ if (d -145068.0) daynumb =d;/* otherwise use Gregorian calendar
6、 */ elsea = floor(y / 100.0);b=2-a+floor(a/daynumb = d +b;return(daynumb); /* end GETDAYS */*GETDATE-Thisroutinetakesadoublefloatnumber*representingthenumberofdayssinceJan1,*1980(day1)andreturnstheyearmonthand*dayaspointerintegers*This routine is the opposite of GETDAYS*/ getdate(numb)double numb;do
7、uble doubledate;date = numb;z=intg(date+2444239.0); if(date13.5)month=e-13.0;else month = e - 1.0;if(month2)year=c-else year = c -4715.0;if(year28000.0)dd=dd-28000.0; while(dd0)dd=dd+28000.0;day = dd;day=(day+1)%7)+return(day);/* FRACT -This routine takes a double float number*andreturnsthefractiona
8、lpartasadouble*float number*/ double fract(numb)double numb;int inumb; double while(numb32767)numb-=32767; inumb =numb;fnumb = inumb; return(numb-fnumb); /* end FRACT */* FLOOR -This routine takes a double float number*and returns the next smallest integer*/ double floor(numb)double numb;double fract(), intg(); double out;out = intg(numb);if (numb 0 & fract(numb) != 0) out -= 1.0; return(out); /* end FLOOR */* INTG-*This routine takes a double float numberand re
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 小麥加工資源增值策略考核試卷
- 土木工程建筑排水系統(tǒng)施工考核試卷
- 2017社保培訓(xùn)課件
- 孔樁勞務(wù)合同范本
- 民宅鋪面出售合同范本
- 碼頭設(shè)備采購合同范本
- 購買國外技術(shù)合同范本
- 熱水買賣合同范本
- led燈改造合同范本
- 寵物寄養(yǎng)服務(wù)中動物健康保證協(xié)議
- 華東師大版九年級數(shù)學下冊全冊課時練習(一課一練)
- “課程思政”融入專業(yè)課教學的探索課程思政與專業(yè)課結(jié)合
- 工程結(jié)算審核服務(wù)方案技術(shù)標
- 《中西醫(yī)結(jié)合:心血管疾病的中西醫(yī)防治》
- 鬼谷神掌 (靜月山人整理)
- 動物水、電解質(zhì)代謝及酸堿平衡紊亂-脫水(動物病理學課件)
- 太喜歡體態(tài)訓(xùn)練了
- 裝修客戶需求表
- 小學二年級英語開學第一課課件
- 二年級下冊道德與法治全冊與單元備課
- 資源能力與競爭優(yōu)勢
評論
0/150
提交評論