




全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
这是当时我做的一个小小的课题,希望对你有所帮助#include stdio.h /* Required for MS-DOS use */ #define ENTER 0x1C0D /* Enter key */ int year, month, day; static char *days8 = ,Sunday ,Monday ,Tuesday , Wednesday,Thursday ,Friday ,Saturday ; struct TIMEDATE int year; /* year 1980.2099 */ int month; /* month 1=Jan 2=Feb, etc. */ int day; /* day of month 0.31 */ int hours; /* hour 0.23 */ int minutes; /* minute 0.59 */ int seconds; /* second 0.59 */ int hsecs; /* 1/100ths of second 0.99 */ char dateline47; /* date & time together */ ; static struct TIMEDATE today; main() char cmonth3; char cday3; char cyear5; double getdays(); double daynumb, numbnow; int weekday, retcode, dayer, i; dayer = datetime(&today); clrscn(); for (i=0;i3;+i)cmonthi=0; for (i=0;i3;+i)cdayi=0; for (i=0;i 0) printf(nn%02d-%02d-%d was,month, day, year); if (numbnow - daynumb 0) printf(nn%02d-%02d-%d will be,month, day, year); printf( a %sn,daysweekday); /* end MAIN */ /* * GETDAYS - From integer values of year (YYYY), month * * (MM) and day (DD) this subroutine returns a * * double float 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; /* * Jan 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 * */ else a = floor(y / 100.0); b = 2 - a + floor(a / 4.0); daynumb = d + b; return(daynumb); /* end GETDAYS */ /* * GETDATE - This routine takes a double float number * * representing the number of days since Jan 1,* * 1980 (day 1) and returns the year month and * * day as pointer integers * * This routine is the opposite of GETDAYS * */ getdate(numb) double numb; double a,aa,b,c,d,e,z; double date; date = numb; z = intg(date + 2444239.0); if (date 13.5) month = e - 13.0; else month = e - 1.0; if (month 2) year = c - 4716.0; else year = c - 4715.0; if (year 28000.0) dd = dd - 28000.0; while (dd 0) dd = dd + 28000.0; day = dd; day = (day + 1) % 7) + 1; return(day); /* * FRACT - This routine takes a double float number * * and returns the fractional part as a double * * float number * */ double fract(numb) double numb; int inumb; double fnumb; while (numb 32767) 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 number
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 护理管理总结
- 脑瘫的作业治疗
- 护理三新项目实施路径
- 核医学科科室院感工作总结
- 2024届江苏省南京师范江宁分校中考数学猜题卷含解析
- 食品行业安全合规措施及服务
- 2025财富管理业务年终总结与未来计划
- 金融服务行业风险质量保证措施
- 化工安全基础知识
- 骨科护理教学大赛课件
- 天津市公安局为留置看护总队招聘警务辅助人员笔试真题2024
- 商铺份额代持协议书
- 2025年高分子聚合物市场调查报告
- 2025年安徽马鞍山博望港华燃气有限公司招聘笔试参考题库附带答案详解
- 2024年湖南省永州市江华瑶族自治县数学三上期末检测试题含解析
- 2024年通信安全员ABC证考试试题库附答案
- 2023年广东省乳源瑶族自治县事业单位公开招聘名笔试题带答案
- 王者荣耀考试题及答案
- 住宅工程质量常见问题专项治理自评报告-图文
- 2024-2025学年译林版(2024)初中英语七年级下册教学计划及进度表
- 《中国慢性便秘临床诊断与治疗规范(2024)》解读
评论
0/150
提交评论