C++.docx

上传人:b****8 文档编号:9959024 上传时间:2023-02-07 格式:DOCX 页数:28 大小:20.43KB
下载 相关 举报
C++.docx_第1页
第1页 / 共28页
C++.docx_第2页
第2页 / 共28页
C++.docx_第3页
第3页 / 共28页
C++.docx_第4页
第4页 / 共28页
C++.docx_第5页
第5页 / 共28页
点击查看更多>>
下载资源
资源描述

C++.docx

《C++.docx》由会员分享,可在线阅读,更多相关《C++.docx(28页珍藏版)》请在冰豆网上搜索。

C++.docx

C++

//main.cpp

#include

#include

#include

#include

#include

#include

#include

usingnamespacestd;

classrebook

{

public:

rebook();//默认构造函数

voidnew_book();//新建备忘录

voidalter_book();//修改备忘录

voiddelet_book();//删除备忘录

voidscan_book();//浏览记事本

private:

stringsigns;//标题

stringdata;//日期

stringwhere;//地点

stringthings;//事件

stringwhat;//事件描述

};

//日期类

classwhatdata

{

public:

whatdata();//默认构造函数

intIsLeapYear(intYear);

longYearDays(intYear);

longTotalDays(intYear,intMonth,intDay);

intGetLunar(intY1,intM1,intD1,int&Y2,int&M2,int&D2);

charinter_face();//首页

voidsearch_data();//日历查询

voidbook_manage();//备忘录管理

voidselect_day();//万年历之日历查询

voidselect_month();//万年历之月历查询

private:

rebookabook;

stringweek;

stringmonth;

stringday;

stringyear;

};

#defineBEGINYEAR1900

#defineYEARCOUNT150

structLUNARINDEX//农历大小月数据索引结构,数据时间自1900年至2050年

{

longDays;//天数,表示该农历年1月1日距公历元年元月1日的天数

shortMon13;//该数据的0至12位分别标明农历1至13月的大小,含闰月

shortLeap;//该年的农历闰月值,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

intmonth1[12]={31,28,31,30,31,30,31,31,30,31,30,31};

stringweek1[7]={"星期一","星期二","星期三","星期四","星期五","星期六","星期日"};

stringmonth2[12]={"一","二","三","四","五","六","七","八","九","十","十一","十二"};

stringweeks[7]={"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};

stringmonths[12]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep",

"Oct","Nov","Dec"};

//默认构造函数

rebook:

:

rebook()//

{

where="xxx";//地点

things="xxx";//事件

what="xxx";//事件描述

signs="xxx";//标题

data="xxx";//日期

}

//新建备忘录

voidrebook:

:

new_book()

{

system("cls");

cout<

time_ttimer;

time(&timer);

cout<

"<

cout<<"标题:

";

cin>>signs;

ofstreamtempFile("record\\temp.txt");

time(&timer);

tempFile<<"时间:

"<

<<"标题:

"<

<<"内容:

";

cout<

"<

tempFile<

stringstr;

while

(1)

{

cin>>str;

if(str[str.length()-1]=='#')

{

str[str.length()-1]='';

tempFile<

break;

}

tempFile<

}

tempFile.close();

ofstreamreFile1("record\\title.txt",ios:

:

app);

reFile1<

reFile1.close();

stringfname="record\\"+signs+".txt";

ofstreamreFile(fname.c_str());

ifstreamtempFile1("record\\temp.txt");

assert(tempFile1);

reFile<

tempFile1.close();

reFile.close();

cout<

!

!

"<

system("pause");

}

//修改备忘录

voidrebook:

:

alter_book()

{

while

(1)

{

system("cls");

cout<

"<

inti=1;

ifstreamreFile("record\\title.txt");

if(!

reFile)

{

ofstreamreFile1("record\\title.txt");

reFile1.close();

ifstreamreFile("record\\title.txt");

}

while(reFile>>signs)

{

reFile.get();

getline(reFile,data);

cout<

:

left)<

<

i++;

}

reFile.close();

cout<

cout<<"选择:

";

intselect;

cin>>select;

if(select==i)

return;

ifstreamreFile2("record\\title.txt");

assert(reFile2);

i=1;

while(reFile2>>signs)

{

reFile2.get();

getline(reFile2,data);

if(i==select)

{

stringfname="record\\"+signs+".txt";

system("cls");

ifstreamreFile3(fname.c_str());

assert(reFile3);

cout<

"<

cout<

reFile3.close();

ofstreamtempFile("record\\temp.txt");

cout<

"<

tempFile<<"标题:

"<

tempFile<<"内容:

";

cout<<"内容:

";

stringstr;

while

(1)

{

cin>>str;

if(str[str.length()-1]=='#')

{

str[str.length()-1]='';

tempFile<

break;

}

tempFile<

}

tempFile.close();

ifstreamtempFile1("record\\temp.txt");

assert(tempFile1);

ofstreamreFile4(fname.c_str());

reFile4<

tempFile1.close();

reFile4.close();

cout<

!

!

!

"<

system("pause");

break;

}

i++;

}

reFile2.close();

}

}

//删除备忘录

voidrebook:

:

delet_book()

{

while

(1)

{

system("cls");

cout<

"<

ifstreamreFile("record\\title.txt");

if(!

reFile)

{

ofstreamreFile1("record\\title.txt");

reFile1.close();

ifstreamreFile("record\\title.txt");

}

inti=1;

while(reFile>>signs)

{

reFile.get();

getline(reFile,data);

cout<

:

left)<

<

i++;

}

reFile.close();

cout<

intselect;

cout<<"选择:

";

cin>>select;

if(select==i)

return;

ifstreamreFile2("record\\title.txt");

assert(reFile2);

ofstreamtempFile("record\\temp.txt");

i=1;

while(reFile2>>signs)

{

reFile2.get();

getline(reFile2,data);

if(i!

=select)

tempFile<

else

{

system("cls");

cout<

"<

stringfname="record\\"+signs+".txt";

ifstreamreFile3(fname.c_str());

assert(reFile3);

cout<

reFile3.close();

}

getline(reFile2,data);

i++;

}

reFile2.close();

tempFile.close();

ifstreamtempFile1("record\\temp.txt");

assert(tempFile1);

ofstreamreFile4("record\\title.txt");

reFile4<

tempFile1.close();

reFile4.close();

cout<

!

!

"<

system("pause");

}

}

//浏览记事本

voidrebook:

:

scan_book()

{

while

(1)

{

system("cls");//

cout<

ifstreamreFile("record\\title.txt");

if(!

reFile)

{

ofstreamreFile1("record\\title.txt");

reFile1.close();

ifstreamreFile("record\\title.txt");

}

inti=1;

cout<<"序号\t"<

:

left)<

while(reFile>>signs)

{

reFile.get();

getline(reFile,data);

cout<

:

left)<

<

i++;

}

reFile.close();

cout<

intselect;

cout<

";

cin>>

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 农林牧渔 > 林学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1