下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、這是當(dāng)時(shí)我做的一個(gè)小小的課題,希望對(duì)你有所幫助#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等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年建筑陶瓷釉料五年成本控制報(bào)告
- 2025陜西聚旺偉業(yè)房地產(chǎn)開發(fā)有限公司招聘(4人)筆試參考題庫附帶答案詳解(3卷合一版)
- 2025年CFA二級(jí)英文真題集
- 2025遼寧大連海創(chuàng)投資集團(tuán)有限公司高級(jí)管理人員擬聘任人選筆試參考題庫附帶答案詳解(3卷)
- 2025福建省高速公路集團(tuán)招聘50人筆試參考題庫附帶答案詳解(3卷合一版)
- 2025福建南平武夷新區(qū)城市服務(wù)有限公司招聘7人筆試參考題庫附帶答案詳解(3卷合一版)
- 律師職業(yè)資格考試復(fù)習(xí)資料及答案參考
- 2025湖南人才市場有限公司選聘13人筆試參考題庫附帶答案詳解(3卷合一版)
- 2025浙江舟山昊思信息技術(shù)有限公司招聘2人筆試參考題庫附帶答案詳解(3卷合一版)
- 2025浙江溫州市人才資源開發(fā)有限公司招聘勞務(wù)派遣人員招聘37人筆試參考題庫附帶答案詳解(3卷合一版)
- 鋼軌探傷工勞動(dòng)安全培訓(xùn)課件
- 新疆交通投資責(zé)任有限公司 筆試內(nèi)容
- 檢修安全培訓(xùn)內(nèi)容課件
- 公路養(yǎng)護(hù)培訓(xùn)課件
- 2025年6月浙江省高考化學(xué)試卷真題(含答案及解析)
- 天車安全培訓(xùn)教學(xué)課件
- 2025年丹梔逍遙丸行業(yè)研究報(bào)告及未來行業(yè)發(fā)展趨勢預(yù)測
- 醫(yī)院清潔消毒培訓(xùn)
- 安全事故三要素培訓(xùn)總結(jié)課件
- 儲(chǔ)能項(xiàng)目并網(wǎng)消防專篇
- 智能投資顧問課件
評(píng)論
0/150
提交評(píng)論