


下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 租房補(bǔ)房協(xié)議書
- 考試培訓(xùn)協(xié)議書
- 老人分?jǐn)倕f(xié)議書
- 終止醫(yī)保協(xié)議書
- 聯(lián)合共享協(xié)議書
- 遺產(chǎn)聲明協(xié)議書
- 幼兒園會(huì)計(jì)合同協(xié)議書
- 教培合伙人合同協(xié)議書
- 無責(zé)方自行協(xié)商協(xié)議書
- 生豬領(lǐng)養(yǎng)協(xié)議書
- 2025年六一兒童節(jié)校長(zhǎng)致辭:每個(gè)孩子都是一朵會(huì)發(fā)光的花
- 公司應(yīng)急演練方案
- 2025保密法宣傳專題培訓(xùn)課件
- 班組安全教育試題及答案
- 虎符銅砭刮痧課件
- 《醫(yī)療機(jī)構(gòu)工作人員廉潔從業(yè)九項(xiàng)準(zhǔn)則》解讀
- 水產(chǎn)養(yǎng)殖網(wǎng)箱租賃與飼料供應(yīng)合作協(xié)議
- 2025年全國(guó)保密教育線上培訓(xùn)考試試題庫(kù)含答案(新)附答案詳解
- 《神經(jīng)網(wǎng)絡(luò)模型》課件
- 四川省成都外國(guó)語(yǔ)2025年高三聯(lián)考數(shù)學(xué)試題科試題含解析
- (四調(diào))武漢市2025屆高中畢業(yè)生四月調(diào)研考試 英語(yǔ)試卷(含答案)
評(píng)論
0/150
提交評(píng)論