


下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 商鋪托管經營合同范本
- 學生班干部競選模板自我介紹20
- 學生身心健康情緒管理學生營養日20
- 2025授權出版合同樣本
- 沙子土地出售合同范本
- 2025網站委托建設合同模板
- 語料庫語言學知到課后答案智慧樹章節測試答案2025年春魯東大學
- 2025辦公寫字樓租賃合同樣本
- 共創綠色未來
- 高一英語學案:預習導航Workingtheland-SectionⅢ
- 江西省八所重點2025屆高三下學期4月聯考(二模)政治試卷(含答案)
- 2025年青藏鐵路集團有限公司招聘(184人)筆試參考題庫附帶答案詳解
- 2025資陽輔警考試題庫
- 第一篇 專題三 計算題培優3 帶電粒子在交變場和立體空間中的運動-2025高考物理二輪復習
- 學校保潔方案
- 心肺復蘇及AED的使用
- “十四五”生物質能源發展規劃
- 《黃帝內經素問》注序.ppt
- 第4章不銹鋼及耐熱鋼的焊接
- 大醫院凈化工程施工組織設計方案
- 長江重點生態區(含川滇生態屏障)生態保護和修復規劃
評論
0/150
提交評論