6、日历记事本
要求:带有日程提醒功能的日历。
显示信息:用户可以向前查询前一个月的日期,也可以向后查询下一个月的日期。
定时提醒:用户可以针对某一天来添加,删除和编辑这一天的日程提醒信息,当系统时间和提醒时间相吻合时,给出具有提示信息的对话框。
查询信息:用户可以查询到某个月的所有的提示信息。
1. #include <iostream>
2. #include <string>
3. #include <iomanip>
4. #include <fstream>
5. #include <ctime>
6. #include <cassert>
7. #include <conio.h>
8. using namespace std;
9. class rebook
10. {
11. public:
12. rebook();
13. void new_book();
14. void alter_book();
15. void delet_book();
16. void scan_book();
17. private:
18. string signs;//标题
19. string data;//日期
20. string where;//地点
21. string things;//事件
22. string what;//事件描述
23. };
24.
25.
26. class whatdata
27. {
28. public:
29. whatdata();
30. int IsLeapYear(int Year);
31. long YearDays(int Year);
32. long TotalDays(int Year, int Month, int Day);
33. int GetLunar(int Y1, int M1, int D1, int &Y2, int &M2, int &D2);
34. char inter_face();//首页
35. void search_data();//日历查询
36. void book_manage();//备忘录管理
37. void select_day();//万年历之日历查询
38. void select_month();//万年历之月历查询
39. private:
40. rebook abook;
41. string week;
42. string month;
43. string day;
44. string year;
45. };
46. #define BEGINYEAR 1900
47. #define YEARCOUNT 150
48.
49. struct LUNARINDEX
50. {
51. long Days;
52. short Mon13;
53. short Leap;
54. }LunarIndex[]={
55. {693626, 0X16D2, 8}, {694010, 0X0752, 15}, {694364, 0X0EA5, 15}, //1900
56. {694719, 0X164A, 5}, {695102, 0X064B, 15}, {695456, 0X0A9B, 15},
57. {695811, 0X1556, 4}, {696195, 0X056A, 15}, {696549, 0X0B59, 15},
58. {696904, 0X1752, 2}, {697288, 0X0752, 15}, {697642, 0X1B25, 6},
59. {698026, 0X0B25, 15}, {698380, 0X0A4B, 15}, {698734, 0X14AB, 5}, // 1914
60. {699118, 0X02AD, 15}, {699472, 0X056B, 15}, {699827, 0X0B69, 2},
61. {700211, 0X0DA9, 15}, {700566, 0X1D92, 7}, {700950, 0X0E92, 15},
62. {701304, 0X0D25, 15}, {701658, 0X1A4D, 5}, {702042, 0X0A56, 15},
63. {702396, 0X02B6, 15}, {702750, 0X15B5, 4}, {703135, 0X06D4, 15},
64. {703489, 0X0EA9, 15}, {703844, 0X1E92, 2}, {704228, 0X0E92, 15}, //1929
65. {704582, 0X0D26, 6}, {704965, 0X052B, 15}, {705319, 0X0A57, 15},
66. {705674, 0X12B6, 5}, {706058, 0X0B5A, 15}, {706413, 0X06D4, 15},
67. {706767, 0X0EC9, 3}, {707151, 0X0749, 15}, {707505, 0X1693, 7},
68. {707889, 0X0A93, 15}, {708243, 0X052B, 15}, {708597, 0X0A5B, 6},
69. {708981, 0X0AAD, 15}, {709336, 0X056A, 15}, {709690, 0X1B55, 4}, //1944
70. {710075, 0X0BA4, 15}, {710429, 0X0B49, 15}, {710783, 0X1A93, 2},
71. {711167, 0X0A95, 15}, {711521, 0X152D, 7}, {711905, 0X0536, 15},
72. {712259, 0X0AAD, 15}, {712614, 0X15AA, 5}, {712998, 0X05B2, 15},
73. {713352, 0X0DA5, 15}, {713707, 0X1D4A, 3}, {714091, 0X0D4A, 15},
74. {714445, 0X0A95, 8}, {714828, 0X0A97, 15}, {715183, 0X0556, 15}, //1959
75. {715537, 0X0AB5, 6}, {715921, 0X0AD5, 15}, {716276, 0X06D2, 15},
76. {716630, 0X0EA5, 4}, {717014, 0X0EA5, 15}, {717369, 0X064A, 15},
77. {717722, 0X0C97, 3}, {718106, 0X0A9B, 15}, {718461, 0X155A, 7},
78. {718845, 0X056A, 15}, {719199, 0X0B69, 15}, {719554, 0X1752, 5},
79. {719938, 0X0B52, 15}, {720292, 0X0B25, 15}, {720646, 0X164B, 4}, //1974
80. {721030, 0X0A4B, 15}, {721384, 0X14AB, 8}, {721768, 0X02AD, 15},
81. {722122, 0X056D, 15}, {722477, 0X0B69, 6}, {722861, 0X0DA9, 15},
82. {723216, 0X0D92, 15}, {723570, 0X1D25, 4}, {723954, 0X0D25, 15},
83. {724308, 0X1A4D, 10}, {724692, 0X0A56, 15}, {725046, 0X02B6, 15},
84. {725400, 0X05B5, 6}, {725784, 0X06D5, 15}, {726139, 0X0EA9, 15}, //1989
85. {726494, 0X1E92, 5}, {726878, 0X0E92, 15}, {727232, 0X0D26, 15},
86. {727586, 0X0A56, 3}, {727969, 0X0A57, 15}, {728324, 0X14D6, 8},
87. {728708, 0X035A, 15}, {729062, 0X06D5, 15}, {729417, 0X16C9, 5},
88. {729801, 0X0749, 15}, {730155, 0X0693, 15}, {730509, 0X152B, 4},
89. {730893, 0X052B, 15}, {731247, 0X0A5B, 15}, {731602, 0X155A, 2}, //2004
90. {731986, 0X056A, 15}, {732340, 0X1B55, 7}, {732725, 0X0BA4, 15}, //2007
91. {733079, 0X0B49, 15}, {733433, 0X1A93, 5}, {733817, 0X0A95, 15},
92. {734171, 0X052D, 15}, {734525, 0X0AAD, 4}, {734909, 0X0AB5, 15},
93. {735264, 0X15AA, 9}, {735648, 0X05D2, 15}, {736002, 0X0DA5, 15},
94. {736357, 0X1D4A, 6}, {736741, 0X0D4A, 15}, {737095, 0X0C95, 15}, //2019
95. {737449, 0X152E, 4}, {737833, 0X0556, 15}, {738187, 0X0AB5, 15},
96. {738542, 0X15B2, 2}, {738926, 0X06D2, 15}, {739280, 0X0EA5, 6},
97. {739664, 0X0725, 15}, {740018, 0X064B, 15}, {740372, 0X0C97, 5},
98. {740756, 0X0CAB, 15}, {741111, 0X055A, 15}, {741465, 0X0AD6, 3},
99. {741849, 0X0B69, 15}, {742204, 0X1752, 11}, {742588, 0X0B52, 15}, //2034
100. {742942, 0X0B25, 15}, {743296, 0X1A4B, 6}, {743680, 0X0A4B, 15},
101. {744034, 0X04AB, 15}, {744388, 0X055B, 5}, {744772, 0X05AD, 15},
102. {745127, 0X0B6A, 15}, {745482, 0X1B52, 2}, {745866, 0X0D92, 15},
103. {746220, 0X1D25, 7}, {746604, 0X0D25, 15}, {746958, 0X0A55, 15},
104. {747312, 0X14AD, 5}, {747696, 0X04B6, 15}, {748050, 0X05B5, 15}, //2049
105. {748405, 0X1DAA, 3}}; //2050
106.
107.
108. int month1[12]={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
109. string week1[7]={"星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"};
110. string month2[12]={"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"};
111. string weeks[7] = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
112. string months[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
113. "Oct", "Nov", "Dec"};
114.
115.
116. //默认构造函数
117. rebook::rebook()
118. {
119. where = "xxx";//地点
120. things = "xxx";//事件
121. what = "xxx";//事件描述
122. signs = "xxx";//标题
123. data = "xxx";//日期
124. }
125.
126. //新建备忘录
127. void rebook::new_book()
128. {
129. system("cls");
130. cout <<endl <<"记事(以'#'表示结束)" <<endl;
131. time_t timer;
132. time(&timer);
133.
134. cout <<endl <<"时间 : "<<asctime(localtime(&timer)) <<endl;
135. cout <<"标题 : ";
136. cin >>signs;
137.
138. ofstream tempFile("record\\temp.txt");
139. time(&timer);
140. tempFile <<"时间 : "<<asctime(localtime(&timer)) <<endl
141. <<"标题 : " <<signs <<endl <<endl
142. <<"内容 : ";
143.
144. cout <<endl <<"内容 : " << endl;
145. tempFile << endl << endl ;
146. string str;
147. while (1)
148. {
149. cin >>str;
150. if (str[str.length()-1] == '#')
151. {
152. str[str.length()-1] = ' ';
153. tempFile <<str <<endl <<endl;
154. break;
155. }
156. tempFile <<str <<endl <<endl;
157. }
158. tempFile.close();
159. ofstream reFile1("record\\title.txt", ios::app);
160. reFile1 <<signs <<endl <<asctime(localtime(&timer)) <<endl;
161. reFile1.close();
162. string fname = "record\\"+signs+".txt";
163. ofstream reFile(fname.c_str());
164. ifstream tempFile1("record\\temp.txt");
165. assert(tempFile1);
166. reFile <<tempFile1.rdbuf();
167. tempFile1.close();
168. reFile.close();
169. cout <<endl <<endl <<"记录已经保存!!!" <<endl <<endl;
170. system("pause");
171. }
172.
173.
174. //修改备忘录
175. void rebook::alter_book()
176. {
177. while (1)
178. {
179. system("cls");
180. cout <<endl <<"请选择你想修改的标题 : " <<endl <<endl;
181. int i = 1;
182. ifstream reFile("record\\title.txt");
183. if (!reFile)
184. {
185. ofstream reFile1("record\\title.txt");
186. reFile1.close();
187. ifstream reFile("record\\title.txt");
188. }
189. while (reFile >>signs)
190. {
191. reFile.get();
192. getline(reFile, data);
193. cout <<i <<".\t" <<setiosflags(ios::left) <<setw(30) <<signs <<" "
194. <<data <<endl <<endl;
195. i++;
196. }
197. reFile.close();
198. cout <<endl <<i <<".\t返回" <<endl <<endl;
199. cout <<"选择 : ";
200. int select;
201. cin >>select;
202. if (select == i)
203. return;
204.
205. ifstream reFile2("record\\title.txt");
206. assert(reFile2);
207. i = 1;
208. while (reFile2 >>signs)
209. {
210. reFile2.get();
211. getline(reFile2, data);
212. if (i == select)
213. {
214. string fname = "record\\"+signs+".txt";
215. system("cls");
216. ifstream reFile3(fname.c_str());
217. assert(reFile3);
218. cout <<endl <<"你想修改的内容如下 : " <<endl <<endl;
219. cout <<reFile3.rdbuf();
220. reFile3.close();
221. ofstream tempFile("record\\temp.txt");
222. cout <<endl <<endl <<"请在下面输入新的内容 (以'#'结束): " <<endl <<endl;
223. tempFile <<"标题 : " <<signs <<endl <<endl;
224. tempFile <<"内容 : ";
225. cout <<"内容 : ";
226. string str;
227. while (1)
228. {
229. cin >>str;
230. if (str[str.length()-1] == '#')
231. {
232. str[str.length()-1] = ' ';
233. tempFile <<str <<endl;
234. break;
235. }
236. tempFile <<str <<endl;
237. }
238. tempFile.close();
239. ifstream tempFile1("record\\temp.txt");
240. assert(tempFile1);
241. ofstream reFile4(fname.c_str());
242. reFile4 <<tempFile1.rdbuf();
243. tempFile1.close();
244. reFile4.close();
245. cout <<endl <<endl <<"内容更新完成!!!!" <<endl <<endl;
246. system("pause");
247. break;
248. }
249. i++;
250. }
251. reFile2.close();
252. }
253. }
254.
255.
256. //删除备忘录
257. void rebook::delet_book()
258. {
259. while (1)
260. {
261. system("cls");
262. cout <<endl <<"请选择一个你想删除的标题 : " <<endl <<endl;
263. ifstream reFile("record\\title.txt");
264. if (!reFile)
265. {
266. ofstream reFile1("record\\title.txt");
267. reFile1.close();
268. ifstream reFile("record\\title.txt");
269. }
270. int i = 1;
271. while (reFile >>signs)
272. {
273. reFile.get();
274. getline(reFile, data);
275. cout <<i <<".\t" <<setiosflags(ios::left) <<setw(30) <<signs <<" "
276. <<data <<endl <<endl;
277. i++;
278. }
279. reFile.close();
280. cout <<endl <<i <<".\t返回" <<endl <<endl;
281. int select;
282. cout <<"选择 : ";
283. cin >>select;
284. if (select == i)
285. return;
286. ifstream reFile2("record\\title.txt");
287. assert(reFile2);
288. ofstream tempFile("record\\temp.txt");
289. i = 1;
290. while (reFile2 >>signs)
291. {
292. reFile2.get();
293. getline(reFile2, data);
294. if (i != select)
295. tempFile <<signs <<endl <<data <<endl <<endl;
296. else
297. {
298. system("cls");
299. cout <<endl <<endl <<"你想删除的备忘录内容如下 : " <<endl <<endl;
300. string fname = "record\\"+signs+".txt";
301. ifstream reFile3(fname.c_str());
302. assert(reFile3);
303. cout <<reFile3.rdbuf();
304. reFile3.close();
305. }
306. getline(reFile2, data);
307. i++;
308. }
309. reFile2.close();
310. tempFile.close();
311. ifstream tempFile1("record\\temp.txt");
312. assert(tempFile1);
313. ofstream reFile4("record\\title.txt");
314. reFile4 <<tempFile1.rdbuf();
315. tempFile1.close();
316. reFile4.close();
317. cout <<endl <<endl <<"该条备忘录已经删除!!!" <<endl <<endl;
318. system("pause");
319. }
320. }
321.
322.
323. //浏览记事本
324. void rebook::scan_book()
325. {
326. while (1)
327. {
328. system("cls");
329. cout <<endl <<"记事本查询" <<endl <<endl;
330. ifstream reFile("record\\title.txt");
331. if (!reFile)
332. {
333. ofstream reFile1("record\\title.txt");
334. reFile1.close();
335. ifstream reFile("record\\title.txt");
336. }
337. int i = 1;
338. cout <<"序号\t" <<setiosflags(ios::left) <<setw(30) <<"标题 " <<"\t日期" <<endl <<endl;
339. while (reFile >>signs)
340. {
341. reFile.get();
342. getline(reFile, data);
343. cout <<i <<".\t" <<setiosflags(ios::left) <<setw(30) <<signs <<" "
344. <<data <<endl <<endl;
345. i++;
346. }
347. reFile.close();
348. cout <<i <<".\t返回";
349. int select;
350. cout <<endl <<endl <<"选择 : ";
351. cin >>select;
352. if (select == i)
353. return;
354. i = 1;
355. ifstream reFile2("record\\title.txt");
356. assert(reFile2);
357. while (reFile2 >>signs)
358. {
359. reFile2.get();
360. getline(reFile2, data);
361. if (i == select)
362. {
363. system("cls");
364. string fname = "record\\"+signs+".txt";
365. ifstream reFile3(fname.c_str());
366. assert(reFile3);
367. cout <<reFile3.rdbuf();
368. reFile3.close();
369. cout <<endl <<endl;
370. system("pause");
371. break;
372. }
373. getline(reFile, data);
374. i++;
375. }
376. reFile2.close();
377. }
378. }
1. whatdata::whatdata():abook()
2. {
3. week = "xxx";
4. month = "xxx";
5. day = "xxx";
6. year = "xxx";
7. }
8.
9.
10. //首页
11. char whatdata::inter_face()
12. {
13. system("cls");
14. char choose;
15.
16. cout << endl;
17. cout<<"\t ● 日 历 记 事 本 ●" <<endl
18. <<"\t ==========================================================" <<endl
19. <<"\t ※ ※" <<endl
20. <<"\t ※ 1. 记事 ※" <<endl
21. <<"\t ※ ※" <<endl
22. <<"\t ※ 2. 浏览 ※" <<endl
23. <<"\t ※ ※" <<endl
24. <<"\t ※ 3. 管理 ※" <<endl
25. <<"\t ※ ※" <<endl
26. <<"\t ※ 4. 日历查询 ※" <<endl
27. <<"\t ※ ※" <<endl
28. <<"\t ※ 5. 关闭记事本 ※" <<endl
29. <<"\t ※ ※" <<endl
30. <<"\t ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※" <<endl <<endl <<"\t\t";
31.
32. choose = getch();
33.
34. return choose;
35. }
36.
37.
38. //日历查询
39. void whatdata::search_data()
40. {
41. while (1)
42. {
43. system("cls");
44. cout << endl << "\t\t万年历查询" << endl << endl ;
45. cout << "\t●\t1. 日历查询 " << endl << endl
46. << "\t●\t2. 月历查询" << endl << endl
47. << "\t●\t3. 返回" << endl << endl;
48.
49. char select = getch();
50. switch (select)
51. {
52. case '1':
53. select_day();//万年历之日历查询
54. break;
55. case '2':
56. select_month();//万年历之月历查询
57. break;
58. case '4':
59. return;
60. default:
61. break;
62. }
63. }
64. }
65.
66. //备忘录管理
67. void whatdata::book_manage()
68. {
69. char choose;
70.
71. while (1)
72. {
73. system("cls");
74. cout <<endl <<"\t管理你的备忘录!!!!!" <<endl <<endl;
75. cout <<endl <<"\t●\t\t 1. 修改备忘录" <<endl
76. <<endl <<"\t●\t\t 2. 删除备忘录" <<endl
77. <<endl <<"\t●\t\t 3. 返回首页" <<endl <<endl <<"\t\t\t";
78.
79. choose = getch();
80. switch (choose)
81. {
82. case '1':
83. abook.alter_book();//修改备忘录
84. break;
85. case '2':
86. abook.delet_book();//删除备忘录
87. break;
88. case '3':
89. return;
90. break;
91. default:
92. break;
93. }
94. }
95. }
96.
97.
98. //日历查询
99. void whatdata::select_day()
100. {
101. system("cls");
102. cout << endl << "\t万年历之日历查询" << endl << endl;
103. cout << "\t请输入年月日 (例如 : 2007 8 15) : ";
104. cin >> year >> month >>day;
105.
106. int days = 0;
107. for (int i = 1; i < atoi(year.c_str()); i++)
108. {
109. if ((i%4 == 0 && i%100 != 0) || (i%400 == 0))
110. days += 366;
111. else
112. days += 365;
113. days = days%7;
114. }
115.
116. if ((i%4 == 0 && i%100 != 0) || (i%400 == 0))
117. month1[1] = 29;
118.
119. for (i = 0; i < atoi(month.c_str()) - 1; i++)
120. days += month1[i];
121. days += atoi(day.c_str());
122. days = days%7;
123. month1[1] = 28;
124.
125. cout <<endl << endl <<"阳历 : ";
126. cout << year << " 年 " << month << " 月 "
127. << day << " 日 \t" << week1[days - 1] << endl << endl ;
128. cout << "阴历 : ";
129. int Y2, M2, D2;
130. GetLunar(atoi(year.c_str()), atoi(month.c_str()), atoi(day.c_str()), Y2, M2, D2);
131. cout << Y2 << " 年 " << M2 << " 月 " << D2 << " 日 " << endl << endl;
132. system ("pause");
133. }
134.
135.
136. //月历查询
137. void whatdata::select_month()
138. {
139. system("cls");
140. cout << endl << "\t万年历之月历查询" << endl << endl;
141. cout << "\t请输入某年某月 (例如 : 2007 8) : " ;
142. cin >> year >> month;
143. cout << endl << endl <<year << " 年 " << month << " 月";
144.
145. if ((atoi(year.c_str())%4 == 0 && atoi(year.c_str())%100 != 0) || (atoi(year.c_str())%400 == 0))
146. {
147. month1[1] = 29;
148. cout << "\t\t\t\t\t\t 闰年" << endl ;
149. }
150. else
151. cout << "\t\t\t\t\t\t 平年" << endl ;
152. cout << "=================================================================" <<endl <<endl;
153. cout << "星期日 星期一 星期二 星期三 星期四 星期五 星期六" <<endl <<endl;
154.
155. int days = 0;
156. for (int i = 1; i < atoi(year.c_str()); i++)
157. {
158. if ((i%4 == 0 && i%100 != 0) || (i%400 == 0))
159. days += 366;
160. else
161. days += 365;
162. days = days%7;
163. }
164.
165. for (i = 0; i < atoi(month.c_str()) - 1; i++)
166. days += month1[i];
167.
168. days = (days + 1)%7;
169. for (int j = 0; j < days; j++)
170. cout << setw(10) << " ";
171. cout << setw(3) << 1;
172.
173. for (j = 2; j <= month1[atoi(month.c_str()) - 1]; j++)
174. {
175. days++;
176. if (days%7 == 0)
177. cout << endl << endl << setw(3) << j;
178. else
179. cout << setw(10) << j ;
180. }
181. cout <<endl << endl <<"===================================================================" <<endl <<endl;
182. month1[1] = 28;
183. fflush(stdin);
184. system("pause");
185. }
186.
187. int whatdata::IsLeapYear(int Year)
188. {
189. if ((Year%4==0 && Year%100!=0) || Year%400==0)
190. return 1;
191. else
192. return 0;
193. }
194.
195. long whatdata::YearDays(int Year)
196. {
197. Year--;
198. return(Year*365+Year/4-Year/100+Year/400+1);
199. }
200. long whatdata::TotalDays(int Year, int Month, int Day)
201. {
202. const int MonthDays[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
203. long Days=0L;
204. int i;
205.
206. if(Month<=0)
207. Month=1;
208. if(Month>12)
209. {
210. Month--;
211. Year+=Month/12;
212. Month%=12;
213. Month++;
214. }
215. for(i=1;i<Month;i++)
216. Days+=MonthDays[i];
217. if(IsLeapYear(Year)&&Month>2)
218. Days+=1;
219. Days+=YearDays(Year);
220. return Days+Day-1;
221. }
222. int whatdata::GetLunar(int Y1, int M1, int D1, int &Y2, int &M2, int &D2)
223. {
224. short MBit[13]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096};
225. long TDays;
226. int Sum,Lest,i,Offset;
227.
228. Offset=Y1-BEGINYEAR;
229. if(Offset<0||Offset>YEARCOUNT)
230. return 0;
231. TDays=TotalDays(Y1,M1,D1);
232. Y2=Y1;
233. if(LunarIndex[Offset].Days>TDays)
234. {
235. if(Offset==0)
236. return 0;
237. Offset--;
238. Y2--;
239. }
240. Lest=(int)(TDays-LunarIndex[Offset].Days);
241. for(Sum=i=0;i<13;i++)
242. {
243. if((LunarIndex[Offset].Mon13&MBit[i])!=0)
244. {
245. Sum+=30;
246. if(Sum>Lest)
247. {
248. Sum-=30;
249. break;
250. }
251. }
252. else
253. {
254. Sum+=29;
255. if(Sum>Lest)
256. {
257. Sum-=29;
258. break;
259. }
260. }
261. }
262. if(i==13)
263. return 0;
264. i++;
265. if(i>LunarIndex[Offset].Leap)
266. {
267. i--;
268. if(i==LunarIndex[Offset].Leap)i=-i;
269. }
270. M2=i;
271. D2=Lest-Sum+1;
272. return 1;
273. }
274. int main()
275. {
276. whatdata object;
277. rebook abook;
278. char select;
279.
280. while (select = object.inter_face())
281. {
282. switch (select)
283. {
284. case '1':
285. abook.new_book();//新建记事本
286. break;
287. case '2':
288. abook.scan_book();//浏览
289. break;
290. case '3':
291. object.book_manage();//备忘录管理
292. break;
293. case '4':
294. object.search_data();//日历查询
295. break;
296. case '5':
297. cout << endl << "\t谢谢使用!!!!" << endl << endl << "\t";
298. exit(0);
299. break;
300. default:
301. break;
302. }
303. }
304. return 0;
305. }
306.