1、C+/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
2、;/事件 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();/备忘录
3、管理 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
4、月的大小,含闰月 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
5、, 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, 7034
6、89, 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, 7089
7、81, 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, 714
8、445, 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, 719
9、938, 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, 7
10、25400, 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, 7
11、30893, 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
12、, 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, 0X0AD
13、6, 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, 0X0A
14、55, 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,
15、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 时间
16、 : 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 st
17、r 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.c
18、lose(); 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返回 e
19、ndl 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 你想修改的内容如下 :
20、 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();
21、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 请选择一个你想删除
22、的标题 : 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)
23、; 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
24、(); 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(
25、) 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
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1