C C++课程设计 日历记事本.doc_第1页
C C++课程设计 日历记事本.doc_第2页
C C++课程设计 日历记事本.doc_第3页
C C++课程设计 日历记事本.doc_第4页
C C++课程设计 日历记事本.doc_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

日历记事本 作者:admin 日期:2008-05-24字体大小: 小 中 大 /main.cpp #include #include #include #include #include #include #include using namespace std;class rebookpublic: rebook();/默认构造函数 void new_book();/新建备忘录 void alter_book();/修改备忘录 void delet_book();/删除备忘录 void scan_book();/浏览记事本private: string signs;/标题 string data;/日期 string where;/地点 string things;/事件 string what;/事件描述;/日期类class whatdatapublic: whatdata();/默认构造函数 int IsLeapYear(int Year); long YearDays(int Year); long TotalDays(int Year, int Month, int Day); int GetLunar(int Y1, int M1, int D1, int &Y2, int &M2, int &D2); char inter_face();/首页 void search_data();/日历查询 void book_manage();/备忘录管理 void select_day();/万年历之日历查询 void select_month();/万年历之月历查询private: rebook abook; string week; string month; string day; string year;#define BEGINYEAR 1900 #define YEARCOUNT 150 struct LUNARINDEX /农历大小月数据索引结构,数据时间自1900年至2050年 long Days; / 天数,表示该农历年1月1日距公历元年元月1日的天数 short Mon13; / 该数据的0至12位分别标明农历1至13月的大小,含闰月 short Leap; / 该年的农历闰月值,15表示无闰月。 LunarIndex= 693626, 0X16D2, 8, 694010, 0X0752, 15, 694364, 0X0EA5, 15, /1900 694719, 0X164A, 5, 695102, 0X064B, 15, 695456, 0X0A9B, 15, 695811, 0X1556, 4, 696195, 0X056A, 15, 696549, 0X0B59, 15, 696904, 0X1752, 2, 697288, 0X0752, 15, 697642, 0X1B25, 6, 698026, 0X0B25, 15, 698380, 0X0A4B, 15, 698734, 0X14AB, 5, / 1914 699118, 0X02AD, 15, 699472, 0X056B, 15, 699827, 0X0B69, 2, 700211, 0X0DA9, 15, 700566, 0X1D92, 7, 700950, 0X0E92, 15, 701304, 0X0D25, 15, 701658, 0X1A4D, 5, 702042, 0X0A56, 15, 702396, 0X02B6, 15, 702750, 0X15B5, 4, 703135, 0X06D4, 15, 703489, 0X0EA9, 15, 703844, 0X1E92, 2, 704228, 0X0E92, 15, /1929 704582, 0X0D26, 6, 704965, 0X052B, 15, 705319, 0X0A57, 15, 705674, 0X12B6, 5, 706058, 0X0B5A, 15, 706413, 0X06D4, 15, 706767, 0X0EC9, 3, 707151, 0X0749, 15, 707505, 0X1693, 7, 707889, 0X0A93, 15, 708243, 0X052B, 15, 708597, 0X0A5B, 6, 708981, 0X0AAD, 15, 709336, 0X056A, 15, 709690, 0X1B55, 4, /1944 710075, 0X0BA4, 15, 710429, 0X0B49, 15, 710783, 0X1A93, 2, 711167, 0X0A95, 15, 711521, 0X152D, 7, 711905, 0X0536, 15, 712259, 0X0AAD, 15, 712614, 0X15AA, 5, 712998, 0X05B2, 15, 713352, 0X0DA5, 15, 713707, 0X1D4A, 3, 714091, 0X0D4A, 15, 714445, 0X0A95, 8, 714828, 0X0A97, 15, 715183, 0X0556, 15, /1959 715537, 0X0AB5, 6, 715921, 0X0AD5, 15, 716276, 0X06D2, 15, 716630, 0X0EA5, 4, 717014, 0X0EA5, 15, 717369, 0X064A, 15, 717722, 0X0C97, 3, 718106, 0X0A9B, 15, 718461, 0X155A, 7, 718845, 0X056A, 15, 719199, 0X0B69, 15, 719554, 0X1752, 5, 719938, 0X0B52, 15, 720292, 0X0B25, 15, 720646, 0X164B, 4, /1974 721030, 0X0A4B, 15, 721384, 0X14AB, 8, 721768, 0X02AD, 15, 722122, 0X056D, 15, 722477, 0X0B69, 6, 722861, 0X0DA9, 15, 723216, 0X0D92, 15, 723570, 0X1D25, 4, 723954, 0X0D25, 15, 724308, 0X1A4D, 10, 724692, 0X0A56, 15, 725046, 0X02B6, 15, 725400, 0X05B5, 6, 725784, 0X06D5, 15, 726139, 0X0EA9, 15, /1989 726494, 0X1E92, 5, 726878, 0X0E92, 15, 727232, 0X0D26, 15, 727586, 0X0A56, 3, 727969, 0X0A57, 15, 728324, 0X14D6, 8, 728708, 0X035A, 15, 729062, 0X06D5, 15, 729417, 0X16C9, 5, 729801, 0X0749, 15, 730155, 0X0693, 15, 730509, 0X152B, 4, 730893, 0X052B, 15, 731247, 0X0A5B, 15, 731602, 0X155A, 2, /2004 731986, 0X056A, 15, 732340, 0X1B55, 7, 732725, 0X0BA4, 15, /2007 733079, 0X0B49, 15, 733433, 0X1A93, 5, 733817, 0X0A95, 15, 734171, 0X052D, 15, 734525, 0X0AAD, 4, 734909, 0X0AB5, 15, 735264, 0X15AA, 9, 735648, 0X05D2, 15, 736002, 0X0DA5, 15, 736357, 0X1D4A, 6, 736741, 0X0D4A, 15, 737095, 0X0C95, 15, /2019 737449, 0X152E, 4, 737833, 0X0556, 15, 738187, 0X0AB5, 15, 738542, 0X15B2, 2, 738926, 0X06D2, 15, 739280, 0X0EA5, 6, 739664, 0X0725, 15, 740018, 0X064B, 15, 740372, 0X0C97, 5, 740756, 0X0CAB, 15, 741111, 0X055A, 15, 741465, 0X0AD6, 3, 741849, 0X0B69, 15, 742204, 0X1752, 11, 742588, 0X0B52, 15, /2034 742942, 0X0B25, 15, 743296, 0X1A4B, 6, 743680, 0X0A4B, 15, 744034, 0X04AB, 15, 744388, 0X055B, 5, 744772, 0X05AD, 15, 745127, 0X0B6A, 15, 745482, 0X1B52, 2, 745866, 0X0D92, 15, 746220, 0X1D25, 7, 746604, 0X0D25, 15, 746958, 0X0A55, 15, 747312, 0X14AD, 5, 747696, 0X04B6, 15, 748050, 0X05B5, 15, /2049 748405, 0X1DAA, 3; /2050 int month112=31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31;string week17=星期一, 星期二, 星期三, 星期四, 星期五, 星期六, 星期日;string month212=一, 二, 三, 四, 五, 六, 七, 八, 九, 十, 十一, 十二;string weeks7 = Mon, Tue, Wed, Thu, Fri, Sat, Sun;string months12 = Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec;/默认构造函数rebook:rebook() where = xxx;/地点 things = xxx;/事件 what = xxx;/事件描述 signs = xxx;/标题 data = xxx;/日期/新建备忘录void rebook:new_book() system(cls); cout endl 记事(以#表示结束) endl; time_t timer; time(&timer); cout endl 时间 : asctime(localtime(&timer) endl; cout signs; ofstream tempFile(recordtemp.txt); time(&timer); tempFile 时间 : asctime(localtime(&timer) endl 标题 : signs endl endl 内容 : ; cout endl 内容 : endl; tempFile endl str; if (strstr.length()-1 = #) strstr.length()-1 = ; tempFile str endl endl; break; tempFile str endl endl; tempFile.close(); ofstream reFile1(recordtitle.txt, ios:app); reFile1 signs endl asctime(localtime(&timer) endl; reFile1.close(); string fname = record+signs+.txt; ofstream reFile(fname.c_str(); ifstream tempFile1(recordtemp.txt); assert(tempFile1); reFile tempFile1.rdbuf(); tempFile1.close(); reFile.close(); cout endl endl 记录已经保存! endl endl; system(pause); /修改备忘录void rebook:alter_book() while (1) system(cls); cout endl 请选择你想修改的标题 : endl signs) reFile.get(); getline(reFile, data); cout i .t setiosflags(ios:left) setw(30) signs data endl endl; i+; reFile.close(); cout endl i .t返回 endl endl; cout select; if (select = i) return; ifstream reFile2(recordtitle.txt); assert(reFile2); i = 1; while (reFile2 signs) reFile2.get(); getline(reFile2, data); if (i = select) string fname = record+signs+.txt; system(cls); ifstream reFile3(fname.c_str(); assert(reFile3); cout endl 你想修改的内容如下 : endl endl; cout reFile3.rdbuf(); reFile3.close(); ofstream tempFile(recordtemp.txt); cout endl endl 请在下面输入新的内容 (以#结束): endl endl; tempFile 标题 : signs endl endl; tempFile 内容 : ; cout str; if (strstr.length()-1 = #) strstr.length()-1 = ; tempFile str endl; break; tempFile str endl; tempFile.close(); ifstream tempFile1(recordtemp.txt); assert(tempFile1); ofstream reFile4(fname.c_str(); reFile4 tempFile1.rdbuf(); tempFile1.close(); reFile4.close(); cout endl endl 内容更新完成! endl endl; system(pause); break; i+; reFile2.close(); /删除备忘录void rebook:delet_book() while (1) system(cls); cout endl 请选择一个你想删除的标题 : endl signs) reFile.get(); getline(reFile, data); cout i .t setiosflags(ios:left) setw(30) signs data endl endl; i+; reFile.close(); cout endl i .t返回 endl endl; int select; cout select; if (select = i) return; ifstream reFile2(recordtitle.txt); assert(reFile2); ofstream tempFile(recordtemp.txt); i = 1; while (reFile2 signs) reFile2.get(); getline(reFile2, data); if (i != select) tempFile signs endl data endl endl; else system(cls); cout endl endl 你想删除的备忘录内容如下 : endl endl; string fname = record+signs+.txt; ifstream reFile3(fname.c_str(); assert(reFile3); cout reFile3.rdbuf(); reFile3.close(); getline(reFile2, data); i+; reFile2.close(); tempFile.close(); ifstream tempFile1(recordtemp.txt); assert(tempFile1); ofstream reFile4(recordtitle.txt); reFile4 tempFile1.rdbuf(); tempFile1.close(); reFile4.close(); cout endl endl 该条备忘录已经删除! endl endl; system(pause); /浏览记事本void rebook:scan_book() while (1) system(cls); cout endl 记事本查询 endl endl; ifstream reFile(recordtitle.txt); if (!reFile) ofstream reFile1(recordtitle.txt); reFile1.close(); ifstream reFile(recordtitle.txt); int i = 1; cout 序号t setiosflags(ios:left) setw(30) 标题 t日期 endl signs) reFile.get(); getline(reFile, data); cout i .t setiosflags(ios:left) setw(30) signs data endl endl; i+; reFile.close(); cout i .t返回; int select; cout endl endl select; if (select = i) return; i = 1; ifstream reFile2(recordtitle.txt); assert(reFile2); while (reFile2 signs) reFile2.get(); getline(reFile2, data); if (i = select) system(cls); string fname = record+signs+.txt; ifstream reFile3(fname.c_str(); assert(reFile3); cout reFile3.rdbuf(); reFile3.close(); cout endl endl; system(pause); break; getline(reFile, data); i+; reFile2.close(); /默认构造函数whatdata:whatdata():abook() week = xxx; month = xxx; day = xxx; year = xxx;/首页char whatdata:inter_face() system(cls); char choose; cout endl; coutt 日 历 记 事 本 endl t = endl t endl t 1. 记事 endl t endl t 2. 浏览 endl t endl t 3. 管理 endl t endl t 4. 日历查询 endl t endl t 5. 关闭记事本 endl t endl t endl endl tt; choose = getch(); return choose;/日历查询void whatdata:search_data() while (1) system(cls); cout endl tt万年历查询 endl endl ; cout tt1. 日历查询 endl endl tt2. 月历查询 endl endl tt3. 返回 endl endl; char select = getch(); switch (select) case 1: select_day();/万年历之日历查询 break; case 2: select_month();/万年历之月历查询 break; case 4: return; default: break; /备忘录管理void whatdata:book_manage() char choose; while (1) system(cls); cout endl t管理你的备忘录! endl endl; cout endl ttt 1. 修改备忘录 endl endl ttt 2. 删除备忘录 endl endl ttt 3. 返回首页 endl endl ttt; choose = getch(); switch (choose) case 1: abook.alter_book();/修改备忘录 break; case 2: abook.delet_book();/删除备忘录 break; case 3: return; break; default: break; /日历查询void whatdata:select_day() system(cls); cout endl t万年历之日历查询 endl endl; cout year month day; int days = 0; for (int i = 1; i atoi(year.c_str(); i+) if (i%4 = 0 & i%100 != 0) | (i%400 = 0) days += 366; else days += 365; days = days%7; if (i%4 = 0 & i%100 != 0) | (i%400 = 0) month11 = 29; for (i = 0; i atoi(month.c_str() - 1; i+) days += month1i; days += atoi(day.c_str(); days = days%7; month11 = 28; cout endl endl 阳历 : ; cout year 年 month 月 day 日 t week1days - 1 endl endl ; cout 阴历 : ; int Y2, M2, D2; GetLunar(atoi(year.c_str(), atoi(month.c_str(), atoi(day.c_str(), Y2, M2, D2); cout Y2 年 M2 月 D2 日 endl endl; system (pause);/月历查询void whatdata:select_month() system(cls); cout endl t万年历之月历查询 endl endl; cout year month; cout endl endl year 年 month 月; if (atoi(year.c_str()%4 = 0 & atoi(year.c_str()%100 != 0) | (atoi(year.c_

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论