{"id":4432,"date":"2024-01-08T12:27:00","date_gmt":"2024-01-08T04:27:00","guid":{"rendered":"http:\/\/www.wangkaixuan.tech\/?p=4432"},"modified":"2024-01-09T10:37:31","modified_gmt":"2024-01-09T02:37:31","slug":"%e8%87%aa%e7%94%a8%e6%97%a5%e8%ae%b0%e6%96%87%e4%bb%b6%e7%94%9f%e6%88%90%e5%b0%8f%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"http:\/\/www.wangkaixuan.tech\/?p=4432","title":{"rendered":"\u81ea\u7528\u65e5\u8bb0\u6587\u4ef6\u751f\u6210\u5c0f\u7a0b\u5e8f"},"content":{"rendered":"\n<p>2023\u5e74\u5df2\u5b8c\u7ed3\uff0c\u53c8\u5230\u4e86\u5f52\u68632023\u5e74\u65e5\u8bb0\uff0c\u751f\u62102024\u5e74\u65e5\u8bb0\u7684\u65f6\u5019\u4e86\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u6211\u81ea\u5df1\u7528\u7684\u751f\u6210\u65e5\u8bb0\u6587\u4ef6\u7684C++\u5c0f\u7a0b\u5e8f\uff0c\u7b80\u4ecb\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8be5\u7a0b\u5e8f\u7f16\u5199\u4e8e2019\u5e747\u67081\u65e5\uff0c\u4e0d\u4ee3\u8868\u672c\u4eba\u5f53\u524d\u6c34\u5e73<\/li>\n\n\n\n<li>\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u751f\u6210\u201c\u65e5\u671f.md\u201d\u7684\u6587\u672c\u6587\u4ef6\uff0c\u6bd4\u5982\u201c20240101.md\u201d<\/li>\n\n\n\n<li>\u65e5\u8bb0\u6587\u4ef6\u9996\u884c\u5305\u62ec\u201c# \u65e5\u671f \u661f\u671f\u51e0\u201d\u7684\u6587\u672c\uff0c\u6bd4\u5982&nbsp;\u201c# 20240101 \u5468\u4e00\u201d<\/li>\n\n\n\n<li>\u652f\u6301\u4fee\u6539\u5e74\u4efd\u3001\u8d77\u59cb\u6708\u4efd\u3001\u622a\u6b62\u6708\u4efd\uff08\u652f\u6301\u95f0\u5e74\uff09<\/li>\n\n\n\n<li>\u5c06\u751f\u6210\u7684\u6587\u672c\u6279\u91cf\u5bfc\u5165MWEB\uff0c\u5373\u53ef\u4f7f\u7528<\/li>\n\n\n\n<li>\u76f4\u63a5\u5c06MWEB\u8d44\u6e90\u5e93\u6587\u4ef6\u5939\u6253\u5305\u8f6c\u79fb\u5373\u53ef\u5907\u4efd\uff0c\u5341\u5206\u65b9\u4fbf<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h&gt;\n#include &lt;string.h&gt;\n\n\/\/g++ -o gen_date_str gen_date_str.cpp\n\nbool is_leap_year(int y)\n{\n\treturn ((y % 400 == 0) || (y % 100 != 0 &amp;&amp; y % 4 == 0));\n}\n\nint days_in_month&#91;12] =\n{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };\n\nconst char *week_day_names&#91;7] =\n{ \"\u5468\u4e00\", \"\u5468\u4e8c\", \"\u5468\u4e09\", \"\u5468\u56db\", \"\u5468\u4e94\", \"\u5468\u516d\", \"\u5468\u65e5\" };\n\nint get_week_day(int y, int m, int d)\n{\n\tif (m == 1 || m == 2) \/\/\u628a\u4e00\u6708\u548c\u4e8c\u6708\u6362\u7b97\u6210\u4e0a\u4e00\u5e74\u7684\u5341\u4e09\u6708\u548c\u662f\u56db\u6708\n\t{\n\t\tm += 12;\n\t\ty--;\n\t}\n\n\treturn (d + 2 * m + 3 * (m + 1) \/ 5 + y + y \/ 4 - y \/ 100 + y \/ 400) % 7;\n}\n\nint main()\n{\n\tint y = 2024;\n\n\tint start_month = 1;\/\/include\n\tint last_month = 12;\/\/include\n\n\t--start_month;\n\t--last_month;\n\n\tif (is_leap_year(y))\n\t\tdays_in_month&#91;1] = 29;\n\n\tfor (int i = start_month; i &lt;= last_month; i++)\n\t{\n\t\tfor (int j = 0; j &lt; days_in_month&#91;i]; j++)\n\t\t{\n\t\t\tchar file_name&#91;1024] = {0};\n\t\t\tsprintf(file_name, \".\/%04d%02d%02d.md\", y, i + 1, j + 1);\n\t\t\tFILE *fp = fopen(file_name, \"ab+\");\n\t\t\tif(fp == NULL)\n\t\t\t{\n\t\t\t\tprintf(\"open file &#91;%s] error, quit !\\n\", file_name);\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\tchar date_str&#91;1024] = {0};\n\t\t\tsprintf(date_str, \"# %04d%02d%02d %s\\n\", y, i + 1, j + 1,\n\t\t\t\t\tweek_day_names&#91;get_week_day(y, i + 1, j + 1)]);\n\t\t\tfwrite(date_str, 1, strlen(date_str), fp);\n\t\t\tfclose(fp);\n\t\t}\n\t}\n\n\treturn 0;\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>2023\u5e74\u5df2\u5b8c\u7ed3\uff0c\u53c8\u5230\u4e86\u5f52\u68632023\u5e74\u65e5\u8bb0\uff0c\u751f\u62102024\u5e74\u65e5\u8bb0\u7684\u65f6\u5019\u4e86\u3002 \u4ee5\u4e0b\u662f\u6211\u81ea\u5df1\u7528\u7684\u751f\u6210\u65e5\u8bb0\u6587\u4ef6\u7684C++\u5c0f\u7a0b\u5e8f\uff0c\u7b80\u4ecb\u5982\u4e0b\uff1a<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-4432","post","type-post","status-publish","format-standard","hentry","category-03-01-"],"_links":{"self":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/4432","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4432"}],"version-history":[{"count":0,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/4432\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4432"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}