{"id":49351,"date":"2025-07-30T17:56:32","date_gmt":"2025-07-30T09:56:32","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/49351.html"},"modified":"2025-07-30T17:56:32","modified_gmt":"2025-07-30T09:56:32","slug":"c%e5%85%a5%e9%97%a8%e8%87%aa%e5%ad%a6day3-c%e7%b1%bb%e4%b8%8e%e5%af%b9%e8%b1%a1%ef%bc%88%e6%8b%b7%e8%b4%9d%e6%9e%84%e9%80%a0%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/49351.html","title":{"rendered":"C++\u5165\u95e8\u81ea\u5b66Day3-- c++\u7c7b\u4e0e\u5bf9\u8c61\uff08\u62f7\u8d1d\u6784\u9020\uff09"},"content":{"rendered":"<h2>C&#043;&#043;\u5185\u5bb9\u5f80\u671f\u56de\u987e&#xff1a;<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0c&#043;&#043;\u7c7b\u4e0e\u5bf9\u8c61&#xff08;\u6784\u9020\u548c\u6790\u6784\u51fd\u6570&#xff09;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0c&#043;&#043;\u7c7b\u4e0e\u5bf9\u8c61&#xff08;\u521d\u8bc62)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0c&#043;&#043;\u7c7b\u4e0e\u5bf9\u8c61&#xff08;\u521d\u8bc6)\u00a0<\/p>\n<p>\u672c\u671f\u5185\u5bb9\u6211\u4eec\u5c06\u7ee7\u7eed\u4ecb\u7ecdc&#043;&#043;\u7c7b\u7684\u6210\u5458\u51fd\u6570&#xff1a;<\/p>\n<h2>\u4e00. \u62f7\u8d1d\u6784\u9020\u51fd\u6570<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u62f7\u8d1d\u6784\u9020\u51fd\u6570&#xff08;Copy Constructor&#xff09;\u662f C&#043;&#043; \u4e2d\u7c7b\u7684\u4e00\u79cd\u7279\u6b8a\u6784\u9020\u51fd\u6570&#xff0c;\u7528\u4e8e\u521b\u5efa\u4e00\u4e2a\u5bf9\u8c61\u662f\u57fa\u4e8e\u53e6\u4e00\u4e2a\u540c\u7c7b\u578b\u5bf9\u8c61\u7684\u526f\u672c&#xff0c;\u5373&#xff1a;<\/p>\n<p> ClassName(const ClassName&amp; other); <\/p>\n<h3>\u00a0 \u00a0 \u00a0 \u00a0 1\u3001\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u7684\u5b9a\u4e49\u5f62\u5f0f<\/h3>\n<p> class MyClass {<br \/>\npublic:<br \/>\n    MyClass(const MyClass&amp; other); \/\/ \u62f7\u8d1d\u6784\u9020\u51fd\u6570<br \/>\n}; <\/p>\n<h5>\u4e3a\u4ec0\u4e48\u9700\u8981\u4f20\u5b9e\u53c2\u7684\u5f15\u7528&amp;\u5462&#xff1f;<\/h5>\n<p>\u4e0d\u59a8\u5047\u8bbe\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u8fd9\u6837\u7684\u7c7b Date:<\/p>\n<p> class Date{<\/p>\n<p>public:<br \/>\n    Date(int year &#061; 2025,int month &#061; 7, int day &#061; 29){<br \/>\n        _year &#061; year;<br \/>\n        _month &#061; month;<br \/>\n        _day &#061; day;<br \/>\n    }<br \/>\n    void Print(){<br \/>\n        \/\/ \u666e\u901a\u51fd\u6570<br \/>\n        cout&lt;&lt; _year&lt;&lt;&#034;-&#034;&lt;&lt;_month&lt;&lt;&#034;-&#034;&lt;&lt;_day&lt;&lt;endl;<br \/>\n    };<br \/>\nprivate:<br \/>\n    int _year;<br \/>\n    int _month;<br \/>\n    int _day;<br \/>\n};<\/p>\n<p>\u8fd9\u91cc\u5982\u679c\u5e38\u89c4\u6211\u4eec\u60f3\u8981\u521b\u5efa\u4e24\u4e2a\u76f8\u540c\u7684\u7c7b\u5b9e\u4f8b\u5316\u7684\u5bf9\u8c61&#xff0c;\u9700\u8981\u8fd9\u4e48\u505a<\/p>\n<p> int main(){<br \/>\n    \/\/\u6784\u9020\u4e00\u6837\u7684\u7c7b<br \/>\n    Date d1(2025,7,29);<br \/>\n    Date d2(2025,7,29); \/\/\u5229\u7528\u6784\u9020\u51fd\u6570\u5b9e\u4f8b\u5316\u4e24\u4e2a\u76f8\u540c\u7684\u7c7b\u5bf9\u8c61<br \/>\n} <\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4f46\u662f\u8fd9\u6837\u4f60\u76f8\u5f53\u4e8e\u5c31\u9700\u8981\u4f20\u4e24\u6b21\u76f8\u540c\u7684\u53c2\u6570&#xff0c;\u5197\u4f59\u7684\u4ee3\u7801\u3002\u90a3\u4e48\u5982\u4f55\u5b9e\u73b0\u62f7\u8d1d\u6784\u9020\u5462&#xff1f;\u6211\u4eec\u5b9a\u4e49\u4e86\u4e0b\u9762\u8fd9\u4e2a\u62f7\u8d1d\u6784\u9020\u51fd\u6570&#xff1a;<\/p>\n<p>     Date(Date d){<br \/>\n        _year &#061; d._year;<br \/>\n        _month &#061; d._month;<br \/>\n        _day &#061; d._day;<br \/>\n    }<br \/>\n int main(){<br \/>\n    Date d1(2025,7,29);<\/p>\n<p>    \/\/\u62f7\u8d1d\u6784\u9020 \u6784\u9020\u51e0\u4e4e\u4e00\u6837\u7684\u7c7b<br \/>\n    Date d2(d1);<\/p>\n<p>} <\/p>\n<p>\u5f53\u4f60\u8fd0\u884c\u65f6&#xff0c;\u7f16\u8bd1\u5668\u4f1a\u62a5\u9519&#xff1a;<\/p>\n<p><span style=\"color:#0d0016\">\u00a0error: copy constructor must pass its first argument by reference \u00a0 \u00a013 | \u00a0 \u00a0 Date(Date d){ \u00a0 \u00a0 \u00a0 | \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ^ \u00a0 \u00a0 \u00a0 | \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 const &amp; 1 error generated.<\/span><\/p>\n<p><span style=\"color:#0d0016\">\u00a0 \u00a0<\/span><span style=\"color:#fe2c24\">\u8fd9\u91cc\u7f16\u8bd1\u5668\u544a\u8bc9\u4f60&#xff0c;\u5728\u5b9a\u4e49\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u65f6&#xff0c;\u9700\u8981\u4f20\u5165\u7684\u662f\u5f15\u7528&#xff0c;\u800c\u4e0d\u662f\u4f20\u5f62\u53c2\u3002\u8fd9\u91cc\u5176\u5b9e\u5c31\u662f\u8003\u5bdf\u6211\u4eec\u5bf9\u4e8e\u51fd\u6570\u8c03\u7528\u7684\u7406\u89e3&#xff0c;\u666e\u901a\u7684\u4f20\u503c\u8c03\u7528&#xff0c;\u4f20\u5165\u7684\u53c2\u6570\u4f1a\u5728\u6808\u4e0a\u518d\u8fdb\u884c\u4e34\u65f6\u7684\u62f7\u8d1d&#xff0c;\u4e5f\u5373\u662f\u4e34\u65f6\u5728\u62f7\u8d1d\u4e00\u4efdDate d1,\u8fd9\u6837d1\u5728\u62f7\u8d1d\u7684\u65f6\u5019\u76f8\u5f53\u4e8e\u53c8\u91cd\u590d\u8c03\u7528\u4e86\u62f7\u8d1d\u6784\u9020&#xff0c;\u90a3\u8fd9\u6837\u4e0d\u65ad\u7684\u4f20\u503c\u8c03\u7528&#8211;\u5c31\u76f8\u5f53\u4e8e\u65e0\u6cd5\u505c\u6b62\u7684\u9012\u5f52\u8c03\u7528\u4e00\u6837&#xff0c;\u662f\u9519\u8bef\u7684\u3002<\/span><\/p>\n<p><span style=\"color:#fe2c24\">\u00a0\u00a0 \u00a0 \u00a0 \u00a0\u603b\u7ed3&#xff1a;<\/span><\/p>\n<p>\u4e00\u8c03\u7528\u5c31\u62f7\u8d1d\u4e00\u6b21&#xff0c;\u800c\u62f7\u8d1d\u53c8\u9700\u8981\u8c03\u7528\u81ea\u5df1 \u2192 \u9012\u5f52\u8c03\u7528 \u2192\u00a0\u6808\u6ea2\u51fa&#xff08;Stack Overflow&#xff09;\u3002<\/p>\n<p>\u6240\u4ee5\u6b63\u786e\u7684\u62f7\u8d1d\u6784\u9020\u5982\u4e0b&#xff1a;<\/p>\n<p>     Date(const Date&amp; d){<br \/>\n        _year &#061; d._year;<br \/>\n        _month &#061; d._month;<br \/>\n        _day &#061; d._day;<br \/>\n    } <\/p>\n<p><span style=\"color:#0d0016\">\u5f15\u7528\u76f8\u5f53\u4e8e\u53c2\u6570\u5730\u5740\u7684\u522b\u540d&#xff0c;\u4f20\u5165\u7684\u5c31\u76f8\u5f53\u4e8e\u5730\u5740\u3002\u4e0d\u9700\u8981\u62f7\u8d1d\u3002\u53c2\u8003&#xff1a;c&#043;&#043;\u57fa\u7840\u5173\u4e8e\u6307\u9488\u548c\u9634\u5f15\u7528\u3002<\/span><\/p>\n<p> int main(){<br \/>\n    \/\/\u6784\u9020\u4e00\u6837\u7684\u7c7b<br \/>\n    Date d1(2025,7,29);<br \/>\n    Date d2(2025,7,29); \/\/\u5229\u7528\u6784\u9020\u51fd\u6570\u5b9e\u4f8b\u5316\u4e24\u4e2a\u76f8\u540c\u7684\u7c7b\u5bf9\u8c61<\/p>\n<p>    \/\/\u62f7\u8d1d\u6784\u9020 \u6784\u9020\u51e0\u4e4e\u4e00\u6837\u7684\u7c7b<br \/>\n    Date d3(d1);<br \/>\n    d3.Print();<\/p>\n<p>} <\/p>\n<p><span style=\"color:#0d0016\">\u8f93\u51fa\u63cf\u8ff0&#xff1a;<\/span><\/p>\n<p><span style=\"color:#0d0016\">2025-7-29<\/span><\/p>\n<\/p>\n<h3>\u00a02\u3001\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u7684\u8c03\u7528\u65f6\u673a<\/h3>\n<h4>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01. \u7528\u4e00\u4e2a\u5bf9\u8c61\u521d\u59cb\u5316\u53e6\u4e00\u4e2a\u5bf9\u8c61\u65f6&#xff1a;<\/h4>\n<\/p>\n<p> MyClass obj1;<br \/>\nMyClass obj2 &#061; obj1;  \/\/ \u8c03\u7528\u62f7\u8d1d\u6784\u9020\u51fd\u6570 <\/p>\n<h4>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a02. \u5bf9\u8c61\u4f5c\u4e3a\u503c\u53c2\u6570\u4f20\u5165\u51fd\u6570\u65f6&#xff1a;<\/h4>\n<p> void func(MyClass obj); \/\/ \u5f62\u53c2\u662f\u503c\u4f20\u9012&#xff0c;\u4e5f\u4f1a\u8c03\u7528\u62f7\u8d1d\u6784\u9020 <\/p>\n<h4>\u00a0 \u00a0 \u00a0 \u00a0 3. \u51fd\u6570\u8fd4\u56de\u7c7b\u5bf9\u8c61\u65f6&#xff08;\u8fd4\u56de\u503c\u4f18\u5316\u524d&#xff09;&#xff1a;<\/h4>\n<p> MyClass func() {<br \/>\n    MyClass tmp;<br \/>\n    return tmp; \/\/ \u53ef\u80fd\u4f1a\u8c03\u7528\u62f7\u8d1d\u6784\u9020<br \/>\n} <\/p>\n<p>\u200b\u200b\u200b\u200b\u200b\u200b<\/p>\n<h3>\u00a03\u3001\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u7684\u9ed8\u8ba4\u884c\u4e3a<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5982\u679c\u4f60\u4e0d\u663e\u5f0f\u5b9a\u4e49\u62f7\u8d1d\u6784\u9020\u51fd\u6570&#xff0c;\u7f16\u8bd1\u5668\u4f1a\u9ed8\u8ba4\u751f\u6210\u4e00\u4e2a&#xff0c;\u8fdb\u884c\u9010\u4e2a\u6210\u5458\u53d8\u91cf\u7684\u6d45\u62f7\u8d1d&#xff08;shallow copy&#xff09;\u3002<\/p>\n<p>\u6211\u4eec\u8fd9\u91cc\u4e0d\u5b9a\u4e49\u4efb\u4f55\u7684\u62f7\u8d1d\u6784\u9020\u51fd\u6570<\/p>\n<p> class Date{<\/p>\n<p>public:<\/p>\n<p>    void Print(){<br \/>\n        \/\/ \u666e\u901a\u51fd\u6570<br \/>\n        cout&lt;&lt; _year&lt;&lt;&#034;-&#034;&lt;&lt;_month&lt;&lt;&#034;-&#034;&lt;&lt;_day&lt;&lt;endl;<br \/>\n    };<br \/>\npublic:<br \/>\n    int _year;<br \/>\n    int _month;<br \/>\n    int _day;<br \/>\n}; <\/p>\n<p>\u4e3b\u51fd\u6570\u5b9a\u4e49\u7c7b\u5bf9\u8c61&#xff1a;<\/p>\n<p> int main(){<\/p>\n<p>    Date d1;<br \/>\n    d1._year &#061; 2025;<br \/>\n    d1._month &#061; 7;<br \/>\n    d1._day &#061; 29;<br \/>\n    \/\/ \u7f16\u8bd1\u5668\u751f\u6210\u9ed8\u8ba4\u62f7\u8d1d\u6784\u9020\u51fd\u6570<br \/>\n    Date d3 &#061; d1;<br \/>\n    d3.Print();<\/p>\n<p>} <\/p>\n<p><span style=\"color:#0d0016\">\u8f93\u51fa\u63cf\u8ff0&#xff1a;<\/span><\/p>\n<p><span style=\"color:#0d0016\">2025-7-29<\/span><\/p>\n<p><span style=\"color:#0d0016\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"color:#fe2c24\">\u9ed8\u8ba4\u7684\u62f7\u8d1d\u51fd\u6570\u540c\u6837\u53ef\u4ee5\u5e2e\u6211\u5b8c\u6210\u5b9e\u4f8b\u5316\u540c\u4e00\u7c7b\u5bf9\u8c61&#xff0c;\u90a3\u4e48\u6211\u4eec\u662f\u5426\u9700\u8981\u81ea\u5b9a\u4e49\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u5462&#xff1f;<\/span><\/p>\n<p><span style=\"color:#fe2c24\">\u8fd9\u91cc\u6211\u4eec\u5c31\u8981\u7406\u89e3\u4e24\u4e2a\u6982\u5ff5&#xff1a;<\/span><span style=\"color:#0d0016\">\u201d\u6d45\u62f7\u8d1d\u548c\u6df1\u62f7\u8d1d\u201c<\/span><\/p>\n<\/p>\n<h4>\u6d45\u62f7\u8d1d&#xff08;\u9ed8\u8ba4\u884c\u4e3a&#xff09;&#xff1a;<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4ec5\u590d\u5236\u6307\u9488\u5730\u5740&#xff0c;\u4e24\u4e2a\u5bf9\u8c61\u5171\u4eab\u540c\u4e00\u5757\u5185\u5b58&#xff0c;\u53ef\u80fd\u5bfc\u81f4\u00a0\u4e8c\u6b21\u91ca\u653e\u6216\u60ac\u7a7a\u6307\u9488\u3002<\/p>\n<p>\u8fd9\u91cc\u6211\u4eec\u6ca1\u6709\u5b9a\u4e49\u62f7\u8d1d\u6784\u9020\u51fd\u6570<\/p>\n<p> class Stack{<br \/>\n    public:<br \/>\n    Stack(int capactity&#061;10){<br \/>\n        _arr &#061; (int*)malloc(sizeof(int)*capactity);<br \/>\n        cout&lt;&lt;&#034;malloc&#034;&lt;&lt;_arr&lt;&lt;endl;<br \/>\n    }<br \/>\n    ~Stack(){<br \/>\n        cout&lt;&lt;&#034;free&#034;&lt;&lt;_arr&lt;&lt;endl;<br \/>\n        free(_arr);<br \/>\n        _arr &#061; nullptr;<br \/>\n    }<br \/>\n    private:<br \/>\n    int* _arr;<br \/>\n    int _size;<br \/>\n    int _capacity;<br \/>\n};<\/p>\n<p>int main(){<br \/>\n    Stack s1;<br \/>\n    Stack s2 &#061; s1;<br \/>\n} <\/p>\n<p>\u8f93\u51fa\u63cf\u8ff0&#xff1a;<\/p>\n<p><span style=\"color:#0d0016\">malloc0x126605fc0 free0x126605fc0 free0x126605fc0 copy_construct(34585,0x204ad1f00) malloc: Double free of object 0x126605fc0 copy_construct(34585,0x204ad1f00) malloc: *** set a breakpoint in malloc_error_break to debug zsh: abort \u00a0 \u00a0 \u00a0&#034;\/Users\/junye\/Desktop\/cplusplus\/&#034;copy_construct<\/span><\/p>\n<\/p>\n<p><span style=\"color:#0d0016\">\u539f\u56e0&#xff1a;\u6211\u4eec\u53ef\u4ee5\u770b\u7684\u8fd9\u91cc\u7a0b\u5e8f\u5d29\u6e83\u4e86&#xff0c;\u6211\u4eecfree\u4e86\u4e24\u6b21\u540c\u4e00\u00a00x126605fc0 \u7684\u5730\u5740\u5bfc\u81f4\u7a0b\u5e8f\u5d29\u6e83&#xff0c;\u8fd9\u662f\u56e0\u4e3a\u9ed8\u8ba4\u7684\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u662f\u201c\u6d45\u62f7\u8d1d\u201d\u4ec5\u4ec5\u53ea\u662f\u590d\u5236\u4e86\u6307\u9488\u5730\u5740&#xff0c;\u4e5f\u5c31\u662f\u4e24\u4e2a\u5bf9\u8c61\u5171\u7528\u540c\u4e00\u5757\u5185\u5b58&#xff0c;\u5f53\u8c03\u7528\u6790\u6784\u51fd\u6570\u6e05\u7406\u5185\u5b58\u65f6&#xff0c;\u76f8\u5f53\u4e8e\u5bf9\u540c\u4e00\u5730\u5740\u6e05\u7406\u4e86\u4e24\u6b21\u5bfc\u81f4\u7a0b\u5e8f\u5d29\u6e83\u3002<\/span><\/p>\n<\/p>\n<h4><span style=\"color:#0d0016\">\u6df1\u62f7\u8d1d&#xff08;\u81ea\u5b9a\u4e49\u7684\u6784\u9020\u51fd\u6570&#xff09;&#xff1a;<\/span><\/h4>\n<p><span style=\"color:#0d0016\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u7533\u8bf7\u72ec\u7acb\u5185\u5b58&#xff0c;\u590d\u5236\u6570\u636e&#xff0c;\u4e92\u4e0d\u5f71\u54cd\u3002<\/span><\/p>\n<p><span style=\"color:#0d0016\">\u4e3e\u4e2a\u4f8b\u5b50&#xff1a;<\/span><\/p>\n<p> class Stack{<br \/>\n    public:<br \/>\n    Stack(int capactity&#061;10){<br \/>\n        _arr &#061; (int*)malloc(sizeof(int)*capactity);<br \/>\n        cout&lt;&lt;&#034;malloc&#034;&lt;&lt;_arr&lt;&lt;endl;<br \/>\n    }<br \/>\n    ~Stack(){<br \/>\n        cout&lt;&lt;&#034;free&#034;&lt;&lt;_arr&lt;&lt;endl;<br \/>\n        free(_arr);<br \/>\n        _arr &#061; nullptr;<br \/>\n    }<br \/>\n    Stack(const Stack&amp; s){<br \/>\n        _size &#061; s._size;<br \/>\n        _capacity &#061; s._capacity;<br \/>\n        _arr &#061; (int*)malloc(sizeof(int)*_capacity);<br \/>\n        memcpy(_arr,s._arr,_capacity);<br \/>\n        cout&lt;&lt;&#034;copy construct &#034;&lt;&lt;_arr&lt;&lt;endl;<br \/>\n    }<br \/>\n    private:<br \/>\n    int* _arr;<br \/>\n    int _size;<br \/>\n    int _capacity;<br \/>\n};<\/p>\n<p>int main(){<br \/>\n    Stack s1;<br \/>\n    \/\/ Stack s2 &#061; s1;\/\/ \u9ed8\u8ba4\u62f7\u8d1d\u6784\u9020<br \/>\n    Stack s2 &#061; Stack(s1);\/\/\u81ea\u5b9a\u4e49\u62f7\u8d1d\u6784\u9020<br \/>\n} <\/p>\n<p><span style=\"color:#0d0016\">\u8f93\u51fa\u63cf\u8ff0&#xff1a;<\/span><\/p>\n<p><span style=\"color:#0d0016\">malloc0x14f605fc0 copy construct 0x14f605e70 free0x14f605e70 free0x14f605fc0<\/span><\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color:#fe2c24\">\u8fd9\u91cc\u6211\u4eec\u5b9a\u4e49\u4e86\u81ea\u5df1\u7684\u62f7\u8d1d\u6784\u9020\u51fd\u6570&#8211;&gt;\u6df1\u62f7\u8d1d&#xff0c;\u7ed9\u6211\u4eec\u62f7\u8d1d\u5bf9\u8c61\u5355\u72ec\u5206\u914d\u5185\u5b58&#xff0c;\u7136\u540e\u590d\u5236\u6570\u636e&#xff0c;\u4e24\u8005\u5728\u6790\u6784\u7684\u65f6\u5019\u4e0d\u4f1a\u4e92\u76f8\u5f71\u54cd\u3002<\/span><\/p>\n<h3>4\u3001\u8fd0\u7b97\u7b26\u91cd\u8f7d&#xff08;operator&#xff09;<\/h3>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u5b9a\u4e49&#xff1a;\u8fd0\u7b97\u7b26\u91cd\u8f7d\u662f C&#043;&#043; \u63d0\u4f9b\u7684\u4e00\u79cd\u673a\u5236&#xff0c;\u5141\u8bb8\u7a0b\u5e8f\u5458\u81ea\u5b9a\u4e49\u5df2\u6709\u8fd0\u7b97\u7b26&#xff08;\u5982 &#043;\u3001-\u3001&#061;\u3001&lt;&lt;\u3001[] \u7b49&#xff09;\u5728\u7528\u6237\u81ea\u5b9a\u4e49\u7c7b\u578b&#xff08;\u7c7b\/\u7ed3\u6784\u4f53&#xff09;\u4e2d\u7684\u884c\u4e3a&#xff0c;\u4f7f\u5f97\u8fd9\u4e9b\u7c7b\u578b\u7684\u5bf9\u8c61\u4e5f\u80fd\u50cf\u5185\u5efa\u7c7b\u578b\u90a3\u6837\u81ea\u7136\u5730\u53c2\u4e0e\u8fd0\u7b97\u3002<span style=\"color:#fe2c24\">\u4e3b\u8981\u9488\u5bf9\u4e8e\u81ea\u5b9a\u4e49\u7c7b\u578b\u7684\u8fd0\u7b97\u3002<\/span><\/p>\n<p><span style=\"color:#fe2c24\">\u00a0<\/span><span style=\"color:#0d0016\">\u00a0 \u00a0 \u00a0 \u00a0\u4e3e\u4e2a\u4f8b\u5b50&#xff0c;\u6bd4\u5982\u6211\u4eec\u8981\u6bd4\u8f83\u4e24\u4e2a\u65e5\u671f\u5bf9\u8c61\u662f\u5426\u76f8\u7b49&#xff0c;\u800c\u65e5\u671f\u662f\u6211\u4eec\u81ea\u5b9a\u4e49\u7684\u7c7b&#xff0c;\u6211\u4eec\u5c31\u8981\u81ea\u5b9a\u4e49\u8fd0\u7b97\u7b26\u53bb\u6bd4\u8f83\u8fd9\u4e24\u4e2a\u5bf9\u8c61\u3002\u5047\u5982<\/span>\u4f60\u5b9a\u4e49\u4e86\u4e00\u4e2a\u590d\u6570\u7c7b&#xff1a;<\/p>\n<p>Complex a(1, 2); Complex b(3, 4); Complex c &#061; a &#043; b; \u00a0\/\/ \u8fd9\u53e5\u9ed8\u8ba4\u662f\u975e\u6cd5\u7684&#xff01;\u56e0\u4e3a\u7cfb\u7edf\u7684\u8fd0\u7b97\u7b26\u53ea\u53ea\u9488\u5bf9\u4e8e\u5185\u7f6e\u7c7b\u578b\u3002<\/p>\n<h4>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u57fa\u672c\u8bed\u6cd5\u683c\u5f0f<\/h4>\n<p>\u8fd4\u56de\u7c7b\u578b operator\u8fd0\u7b97\u7b26(\u53c2\u6570\u5217\u8868) { \u00a0 \u00a0 \/\/ \u81ea\u5b9a\u4e49\u8fd0\u7b97\u884c\u4e3a }<\/p>\n<p> bool operator &#061;&#061;&#xff08;const\u00a0Complex&amp; a,const\u00a0Complex&amp; b){<br \/>\n\u00a0 \u00a0 \u00a0 \u00a0 \/\/ \u81ea\u5b9a\u4e49\u8fd0\u7b97\u884c\u4e3a<br \/>\n} <\/p>\n<p><span style=\"color:#0d0016\">\u8fd9\u6837\u6211\u4eec\u5c31\u5b9a\u4e49\u4e00\u4e2a\u7c7b\u7684\u8fd0\u7b97\u7b26&#xff0c;\u5f53\u7136\u8fd9\u6837\u7684\u8fd0\u7b97\u7b26\u4e0d\u6b62\u4e00\u4e2a&#xff0c;\u5f53\u5b9a\u4e49\u591a\u4e2a\u8fd0\u7b97\u7b26\u65f6&#xff0c;\u6709\u7740\u4e0d\u4e00\u81f4\u7684\u53c2\u6570&#xff0c;\u4e5f\u5c31\u6784\u6210\u4e86\u201c\u8fd0\u7b97\u7b26\u91cd\u8f7d\u201d.<\/span><\/p>\n<p> bool operator&#061;&#061;(const Date&amp; D1,const Date&amp; D2){<br \/>\n    return D1._year &#061;&#061; D2._year &amp;&amp; D1._month &#061;&#061; D2._month<br \/>\n        &amp;&amp; D1._day &#061;&#061; D2._day;<br \/>\n};<\/p>\n<p>int main(){<br \/>\n    \/\/\u6784\u9020\u4e00\u6837\u7684\u7c7b<br \/>\n    Date d1(2025,7,29);<br \/>\n     \/\/\u5229\u7528\u6784\u9020\u51fd\u6570\u5b9e\u4f8b\u5316\u4e24\u4e2a\u76f8\u540c\u7684\u7c7b\u5bf9\u8c61<\/p>\n<p>    \/\/\u62f7\u8d1d\u6784\u9020 \u6784\u9020\u51e0\u4e4e\u4e00\u6837\u7684\u7c7b<br \/>\n    \/\/ Date d3(d1);<br \/>\n    Date d3 &#061; Date(d1);<br \/>\n    if(operator&#061;&#061;(d3,d1)){<br \/>\n        cout&lt;&lt; &#034;True&#034; &lt;&lt; endl;<br \/>\n    }<br \/>\n} <\/p>\n<p><span style=\"color:#0d0016\">\u8f93\u51fa\u63cf\u8ff0&#xff1a;<\/span><\/p>\n<p><span style=\"color:#0d0016\">True<\/span><\/p>\n<p><span style=\"color:#0d0016\">\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><span style=\"color:#fe2c24\">\u00a0\u00a0\u00a0\u6ce8\u610f\u8fd9\u91cc\u6211\u4eec\u5b9a\u4e49\u7684\u7c7b\u7684\u6210\u5458\u53d8\u91cf\u90fd\u662f\u516c\u6709\u7684&#xff0c;\u4f46\u5b9e\u9645\u4e0a\u6211\u4eec\u7c7b\u7684\u6210\u5458\u53d8\u91cf\u4e00\u822c\u90fd\u4e3a\u79c1\u6709\u7684\u3002\u6240\u4ee5\u4e0a\u8ff0\u5b9a\u4e49\u8fd0\u7b97\u7b26\u901a\u5e38\u4e0d\u53ef\u7528\u3002\u90a3\u4e48\u5982\u4f55\u5b9a\u4e49\u4e00\u4e2a\u66f4\u597d\u7684\u8fd0\u7b97\u7b26\u5462&#xff1f;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#fe2c24\">\u00a0\u00a0\u00a0<\/span><span style=\"color:#0d0016\">\u00a0\u00a0\u00a0\u00a0\u00a0<span>\u6211\u4eec\u5c06\u5b9a\u4e49\u7684\u8fd0\u7b97\u7b26\u5b9a\u4e49\u5728\u7c7b\u5185\u90e8\u3002\u5982\u4e0b\u8fd9\u6837\u5c31\u53ef\u4ee5\u8bbf\u95ee\u79c1\u6709\u7684\u6210\u5458\u53d8\u91cf&#xff0c;\u4f46\u662f<\/span><\/span><span style=\"color:#fe2c24\"><span>\u5b9a\u4e49\u5728\u7c7b\u5185\u90e8&#xff0c;\u6211\u4eec\u5728\u8c03\u7528\u8fd0\u7b97\u7b26\u6bd4\u8f83\u4e24\u4e2a\u540c\u7c7b\u65f6&#xff0c;\u4e0d\u9700\u8981\u4f20\u5165\u4e24\u4e2a\u7c7b\u7684\u5f15\u7528&#xff0c;\u56e0\u4e3a\u7c7b\u7684\u5185\u90e8\u6210\u5458\u51fd\u6570\u9690\u542b\u4e86\u201cthis \u6307\u9488\u201d<\/span><\/span><span style=\"color:#0d0016\"><span>&#xff0c;\u6240\u7528\u8c03\u7528\u548c\u5b9a\u4e49\u89c4\u5219\u5982\u4e0b&#xff1a;<\/span><\/span><\/p>\n<\/p>\n<p> class Date{<\/p>\n<p>public:<br \/>\n    Date(int year &#061; 2025,int month &#061; 7, int day &#061; 29){<br \/>\n        _year &#061; year;<br \/>\n        _month &#061; month;<br \/>\n        _day &#061; day;<br \/>\n    }<br \/>\n    void Print(){<br \/>\n        \/\/ \u666e\u901a\u51fd\u6570<br \/>\n        cout&lt;&lt; _year&lt;&lt;&#034;-&#034;&lt;&lt;_month&lt;&lt;&#034;-&#034;&lt;&lt;_day&lt;&lt;endl;<br \/>\n    };<br \/>\n    Date(const Date&amp; d1){<br \/>\n        _year &#061; d1._year;<br \/>\n        _month &#061; d1._month;<br \/>\n        _day &#061; d1._day;<br \/>\n    }<br \/>\n\/\/ \u5b9a\u4e49\u7c7b\u7684\u8fd0\u7b97\u7b26<br \/>\n    bool operator&#061;&#061;(const Date&amp; D2){<br \/>\n        return _year &#061;&#061; D2._year &amp;&amp; _month &#061;&#061; D2._month<br \/>\n        &amp;&amp; _day &#061;&#061; D2._day;<br \/>\n    };<br \/>\npublic:<br \/>\n    int _year;<br \/>\n    int _month;<br \/>\n    int _day;<br \/>\n};<\/p>\n<p>\/\/\u4e3b\u51fd\u6570<br \/>\nint main(){<br \/>\n    \/\/\u6784\u9020\u4e00\u6837\u7684\u7c7b<br \/>\n    Date d1(2025,7,29);<\/p>\n<p>    \/\/\u62f7\u8d1d\u6784\u9020 \u6784\u9020\u51e0\u4e4e\u4e00\u6837\u7684\u7c7b<br \/>\n    Date d3 &#061; Date(d1);<br \/>\n    if(d3.operator&#061;&#061;(d1)){<br \/>\n        cout&lt;&lt; &#034;True&#034; &lt;&lt; endl;<br \/>\n    }<br \/>\n} <\/p>\n<h4>\u8d4b\u503c\u8fd0\u7b97\u7b26\u7684\u5b9e\u73b0&#xff1a;<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8d4b\u503c\u8fd0\u7b97\u7b26\u7684\u672c\u8d28\u5176\u5b9e\u4e5f\u5c31\u662f\u201c\u6df1\u62f7\u8d1d\u201d\u3002<\/p>\n<p> class MyString {<br \/>\nprivate:<br \/>\n    char* _str;<br \/>\npublic:<br \/>\n    MyString(const char* str &#061; &#034;&#034;) {<br \/>\n        _str &#061; new char[strlen(str) &#043; 1];<br \/>\n        strcpy(_str, str);<br \/>\n    }<\/p>\n<p>    \/\/ \u81ea\u5b9a\u4e49\u8d4b\u503c\u8fd0\u7b97\u7b26<br \/>\n    MyString&amp; operator&#061;(const MyString&amp; other) {<br \/>\n        if (this &#061;&#061; &amp;other)<br \/>\n            return *this;  \/\/ 1. \u5904\u7406\u81ea\u8d4b\u503c<\/p>\n<p>        delete[] _str;      \/\/ 2. \u91ca\u653e\u539f\u6709\u8d44\u6e90<\/p>\n<p>        _str &#061; new char[strlen(other._str) &#043; 1];  \/\/ 3. \u5206\u914d\u65b0\u7a7a\u95f4<br \/>\n        strcpy(_str, other._str);                \/\/ 4. \u62f7\u8d1d\u6570\u636e<\/p>\n<p>        return *this;  \/\/ 5. \u8fd4\u56de\u81ea\u8eab\u5f15\u7528<br \/>\n    }<\/p>\n<p>    ~MyString() {<br \/>\n        delete[] _str;<br \/>\n    }<br \/>\n}; <\/p>\n<h4>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6ce8\u610f&#xff1a;\u4ee5\u4e0b\u8fd0\u7b97\u7b26\u65e0\u6cd5\u91cd\u8f7d<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6709\u00a05\u4e2a\u8fd0\u7b97\u7b26\u4e0d\u80fd\u91cd\u8f7d&#xff1a;<\/p>\n<ul>\n<li>\n<p>::&#xff08;\u4f5c\u7528\u57df\u89e3\u6790&#xff09;<\/p>\n<\/li>\n<li>\n<p>.&#xff08;\u6210\u5458\u8bbf\u95ee&#xff09;<\/p>\n<\/li>\n<li>\n<p>.*&#xff08;\u6210\u5458\u6307\u9488\u8bbf\u95ee&#xff09;<\/p>\n<\/li>\n<li>\n<p>sizeof<\/p>\n<\/li>\n<li>\n<p>typeid\u3002<\/p>\n<\/li>\n<li>\n<h3>5\u3001\u5b8c\u5584\u65e5\u671f\u7c7b\u7684\u5b9e\u73b0<\/h3>\n<\/li>\n<\/ul>\n<h4>\u00a0 \u00a0 \u00a0 \u00a0 1. \u7c7b\u4e2d\u6210\u5458\u53d8\u91cf\u7684\u5b9a\u4e49&#xff1a;<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5e74&#xff0c;\u6708&#xff0c;\u65e5&#xff0c;\u6ce8\u610f\u8fd9\u91cc\u6211\u4eec\u8981\u8003\u8651&#xff0c;\u5e73\u95f0\u5e74&#xff0c;\u6bcf\u4e2a\u6708\u7684\u5929\u6570\u3002<\/p>\n<p> class Date{<br \/>\npublic:<br \/>\n    void Print(){<br \/>\n        \/\/ \u666e\u901a\u51fd\u6570<br \/>\n        cout&lt;&lt; _year&lt;&lt;&#034;-&#034;&lt;&lt;_month&lt;&lt;&#034;-&#034;&lt;&lt;_day&lt;&lt;endl;<br \/>\n    };<br \/>\nprivate:<br \/>\n    int _year;<br \/>\n    int _month;<br \/>\n    int _day;<br \/>\n};<\/p>\n<p>\u8fd9\u91cc\u6211\u4eec\u5b9a\u4e49\u4e86\u4e00\u4e2a\u57fa\u672c\u7684Date\u7c7b\u91cc\u9762\u5305\u62ec&#xff0c;\u5e74\u6708\u65e5\u7684\u6210\u5458\u53d8\u91cf\u7684\u5b9a\u4e49&#xff0c;\u4ee5\u53ca\u6253\u5370\u76f8\u5e94\u7684\u53d8\u91cf\u3002<\/p>\n<p>\u6d4b\u8bd5\u51fd\u6570&#xff1a;<\/p>\n<p> int main(){<br \/>\n    Date d2;<br \/>\n    d2.Print();<br \/>\n} <\/p>\n<p><span style=\"color:#0d0016\">\u8f93\u51fa\u63cf\u8ff0&#xff1a;<\/span><\/p>\n<p><span style=\"color:#0d0016\">2-75841712-2<\/span><\/p>\n<p><span style=\"color:#0d0016\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8fd9\u91cc\u6211\u4eec\u7b80\u5355\u5b9e\u4f8b\u5316\u4e86\u4e00\u4e2a\u7c7b\u5bf9\u8c61&#xff0c;\u6ca1\u6709\u5b9a\u4e49\u7c7b\u7684\u6784\u9020\u51fd\u6570&#xff0c;\u4f7f\u7528\u9ed8\u8ba4\u7684\u6784\u9020\u51fd\u6570&#xff0c;\u5219\u7c7b\u7684\u6210\u5458\u53d8\u91cf\u90fd\u4e3a\u968f\u673a\u503c\u3002<\/span><\/p>\n<\/p>\n<h4><span style=\"color:#0d0016\">2. \u5b9a\u4e49\u6784\u9020\u51fd\u6570\u4ee5\u53ca\u62f7\u8d1d\u6784\u9020\u51fd\u6570&#xff08;\u521d\u59cb\u5316\u7c7b\u5bf9\u8c61&#xff09;<\/span><\/h4>\n<p><span style=\"color:#0d0016\">\u00a0 \u00a0 \u00a0 \u00a0 \u521d\u59cb\u5316\u5bf9\u8c61\u65f6&#xff0c;\u6211\u4eec\u9700\u8981\u68c0\u67e5\u8f93\u5165\u7684\u53c2\u6570\u662f\u5426\u6ee1\u8db3\u65e5\u671f\u7684\u6807\u51c6\u5305\u62ec\u68c0\u67e5\u5e73\u95f0\u5e74&#xff0c;\u6bcf\u4e2a\u6708\u7684\u5929\u6570\u3002<\/span><\/p>\n<p>     \/\/\u5e73\u95f0\u5e74&#xff0c;\u6bcf\u4e2a\u6708\u7684\u5929\u6570<br \/>\n    int GetMonthDay(int year, int month){<br \/>\n        static int monthDays[13] &#061; {0,31,28,31,30,31,30,31,31,30,31,30,31}; \/\/\u9759\u6001\u53d8\u91cf&#xff0c;\u7a0b\u5e8f\u7ed3\u675f\u624d\u9500\u6bc1\u5417&#xff0c;\u53ea\u521d\u59cb\u5316\u4e00\u6b21\u3002<br \/>\n        if(month &#061;&#061; 2 &amp;&amp; ((year % 4 &#061;&#061; 0 &amp;&amp; year % 100 !&#061; 0) || year % 400 &#061;&#061; 0)){<br \/>\n            return 29;<br \/>\n        }<br \/>\n        return monthDays[month];<br \/>\n    }<br \/>\n    \/\/\u6784\u9020\u51fd\u6570<br \/>\n    Date(int year &#061; 2025,int month &#061; 7, int day &#061; 29){<br \/>\n        if(year&gt;&#061;0 &amp;&amp; month&gt;&#061;1 &amp;&amp;month&lt;&#061;12 &amp;&amp; day&gt;&#061; 1 &amp;&amp; day&lt;&#061; GetMonthDay(year,month)){<br \/>\n           _year &#061; year;<br \/>\n            _month &#061; month;<br \/>\n            _day &#061; day;<br \/>\n        }<br \/>\n        else{<br \/>\n            cout &lt;&lt; &#034;\u975e\u6cd5\u65e5\u671f&#034; &lt;&lt; endl;<br \/>\n        }<br \/>\n    }<br \/>\n\/\/\u62f7\u8d1d\u6784\u9020\u51fd\u6570<br \/>\n    Date(const Date&amp; d1){<br \/>\n        _year &#061; d1._year;<br \/>\n        _month &#061; d1._month;<br \/>\n        _day &#061; d1._day;<br \/>\n    } <\/p>\n<p>\u8fd9\u91cc\u5b9a\u4e49\u4e86\u6211\u4eec\u521d\u59cb\u5316\u7c7b\u5bf9\u8c61\u6240\u9700\u8981\u7684\u51fd\u6570\u3002\u6d4b\u8bd5\u7684\u4e3b\u51fd\u6570\u5982\u4e0b&#xff1a;<\/p>\n<p> int main(){<br \/>\n    \/\/\u6784\u9020\u51fd\u6570<br \/>\n    Date d2;<br \/>\n    d2.Print();<br \/>\n    \/\/\u62f7\u8d1d\u6784\u9020<br \/>\n    Date d3(d2);<br \/>\n    d3.Print();<br \/>\n    \/\/\u521d\u59cb\u5316<br \/>\n    Date d4(2036,13,67);<br \/>\n} <\/p>\n<p><span style=\"color:#0d0016\">\u8f93\u51fa\u63cf\u8ff0\u5982\u4e0b&#xff1a;<\/span><\/p>\n<p><span style=\"color:#0d0016\">2025-7-29 2025-7-29 \u975e\u6cd5\u65e5\u671f<\/span><\/p>\n<\/p>\n<h4><span style=\"color:#0d0016\">3. \u8fd0\u7b97\u7b26\u91cd\u8f7d\u7684\u5b9a\u4e49<\/span><\/h4>\n<h5><span style=\"color:#0d0016\">1\ufe0f\u20e3\u5224\u65ad\u4e24\u4e2a\u65e5\u671f\u662f\u5426\u4e00\u81f4\u201c&#061;&#061;,!&#061;\u201d<\/span><\/h5>\n<p> \/\/\u9690\u85cf\u4e86this\u6307\u9488&#xff0c;\u76f8\u5f53\u4e8ebool operator&#061;&#061;(Date* &amp;D1,const Date&amp; D2)<br \/>\n    bool operator&#061;&#061;(const Date&amp; D2){<br \/>\n        return _year &#061;&#061; D2._year &amp;&amp; _month &#061;&#061; D2._month<br \/>\n        &amp;&amp; _day &#061;&#061; D2._day;<br \/>\n    };<br \/>\n    bool operator !&#061; (const Date&amp; D2){ \/\/ bool operator!&#061;(Date* this, const Date&amp; D2)<br \/>\n        return !(*this &#061;&#061; D2);<br \/>\n    };  <\/p>\n<p>\u6d4b\u8bd5\u51fd\u6570<\/p>\n<p> int main(){<br \/>\n    \/\/\u6784\u9020\u51fd\u6570<br \/>\n    Date d2;<br \/>\n    d2.Print();<br \/>\n    \/\/\u62f7\u8d1d\u6784\u9020<br \/>\n    Date d3(d2);<br \/>\n    d3.Print();<br \/>\n    if(d3 &#061;&#061; d2){<br \/>\n        cout&lt;&lt;&#034;true&#034;&lt;&lt;endl;<br \/>\n    }<br \/>\n} <\/p>\n<p><span style=\"color:#0d0016\">\u8f93\u51fa\u63cf\u8ff0&#xff1a;<\/span><\/p>\n<p><span style=\"color:#0d0016\">true<\/span><\/p>\n<p><span style=\"color:#0d0016\">2<\/span><\/p>\n<h5><span style=\"color:#0d0016\"><span>2\ufe0f\u20e3\u5224\u65ad\u4e24\u4e2a\u65e5\u671f\u7684\u5927\u5c0f\u201c&gt;, &gt;&#061;,&lt;,&lt;&#061;\u201d<\/span><\/span><\/h5>\n<p>   \/\/\u8c03\u7528\u65f6d1. operator&#061;&#061;(&amp;D1,D2);<br \/>\n    bool operator &gt; (const Date&amp; D2){ \/\/ bool operator &lt;&#061; (Date* this, const Date &amp;d);<br \/>\n        if(_year&gt;D2._year){<br \/>\n            return true;<br \/>\n        }<br \/>\n        if(_year &#061;&#061; D2._year){<br \/>\n            if(_month &gt; D2._month){<br \/>\n                return true;<br \/>\n            }<br \/>\n            else if(_month &#061;&#061; D2._month){<br \/>\n                if(_day &gt; D2._day){<br \/>\n                    return true;<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n        return false;<br \/>\n    };<br \/>\n    \/\/\u903b\u8f91\u8fd0\u7b97\u7b26\u590d\u7528<br \/>\n    \/\/ \u5728\u5b9e\u73b0 &gt;&#061; \u7684\u8fd0\u7b97\u7b26\u65f6&#xff0c;\u53ef\u4ee5\u4f7f\u7528\u5df2\u5b9e\u73b0\u7684\u8fd0\u7b97\u7b26\u5982&gt;\u548c &#061;&#061; \u8fd0\u7b97\u7b26\u3002&gt;&#061; \u7b49\u4ef7\u4e8e &gt; || &#061;&#061;;<br \/>\n    bool operator&gt;&#061;(const Date&amp; D2){ \/\/ bool operator&gt;&#061;(Date* this, const Date&amp; D2)<br \/>\n        return *this &gt; D2 || *this &#061;&#061; D2;<br \/>\n    };<br \/>\n    bool operator&lt;(const Date&amp; D2){ \/\/ bool operator&gt;&#061;(Date* this, const Date&amp; D2)<br \/>\n        return !(*this &gt; D2);<br \/>\n    };<br \/>\n    bool operator &lt;&#061; (const Date&amp; D2){ \/\/ bool operator&gt;&#061;(Date* this, const Date&amp; D2)<br \/>\n        return !(*this &gt;&#061; D2);<br \/>\n    }; <\/p>\n<p><span style=\"color:#fe2c24\">\u8fd9\u91cc\u6211\u4eec\u8fd0\u7528\u4ee5\u53ca\u5b9a\u4e49\u7684\u8fd0\u7b97\u7b26\u6765\u5b9a\u4e49\u5176\u4ed6\u8fd0\u7b97\u7b26&#xff0c;\u8fd9\u662f\u4e00\u79cd\u975e\u5e38\u65b9\u4fbf\u7684\u64cd\u4f5c\u3002<\/span><\/p>\n<p><span style=\"color:#0d0016\">\u6d4b\u8bd5\u51fd\u6570&#xff1a;<\/span><\/p>\n<p> int main(){<br \/>\n    \/\/\u6784\u9020\u51fd\u6570<br \/>\n    Date d2;<br \/>\n    d2.Print();<br \/>\n    \/\/\u62f7\u8d1d\u6784\u9020<br \/>\n    Date d3(2026,12,11);<br \/>\n    if(d3&gt;d2){<br \/>\n        cout&lt;&lt;&#034;True&#034;&lt;&lt;endl;<br \/>\n    }<br \/>\n    Date d4(1998,7,8);<br \/>\n    if(d4&lt;d2){<br \/>\n        cout&lt;&lt;&#034;True&#034;&lt;&lt;endl;<br \/>\n    };<br \/>\n} <\/p>\n<p><span style=\"color:#0d0016\">\u8f93\u51fa\u63cf\u8ff0&#xff1a;<\/span><\/p>\n<p><span style=\"color:#0d0016\">2025-7-29 True True<\/span><\/p>\n<\/p>\n<h5><span style=\"color:#0d0016\">3\ufe0f\u20e3. \u65e5\u671f\u7684\u52a0\u51cf\u64cd\u4f5c\u201c\u65e5\u671f-\u65e5\u671f<\/span><\/h5>\n<p><span style=\"color:#0d0016\">\u65e5\u671f-\u65e5\u671f<\/span><\/p>\n<p> \/\/\u5148\u5c06\u65e5\u671f\u8f6c\u6362\u6210\u5929\u6570&#xff0c;\u518d\u8fdb\u884c\u8fd0\u7b97\u3002<br \/>\n    int DateToDays(){<br \/>\n        int total &#061; 0;<br \/>\n        for(int y &#061; 1; y &lt; _year; &#043;&#043;y)<br \/>\n            total &#043;&#061; ((y % 4 &#061;&#061; 0 &amp;&amp; y % 100 !&#061; 0) || y % 400 &#061;&#061; 0) ? 366 : 365;<br \/>\n        for(int m &#061; 1; m &lt; _month; &#043;&#043;m)<br \/>\n            total &#043;&#061; GetMonthDay(_year, m);<br \/>\n        total &#043;&#061; _day;<br \/>\n        return total;<br \/>\n    };<\/p>\n<p>    int operator-(Date&amp; d2){<br \/>\n        return this-&gt;DateToDays() &#8211; d2.DateToDays();<br \/>\n    }<\/p>\n<p>\u6d4b\u8bd5\u51fd\u6570&#xff1a;<\/p>\n<p> int main(){<br \/>\n    \/\/\u6784\u9020\u51fd\u6570<br \/>\n    Date d2;<br \/>\n    d2.Print();<br \/>\n    Date d3(2025,8,16);<br \/>\n    cout&lt;&lt;&#034;2025,8,16 &#8211; 2025,7,30 &#061; &#034;&lt;&lt; d3-d2 &lt;&lt;endl;<br \/>\n} <\/p>\n<p><span style=\"color:#0d0016\">\u8f93\u51fa\u63cf\u8ff0&#xff1a;<\/span><\/p>\n<p><span style=\"color:#0d0016\">2025,8,16 &#8211; 2025,7,30 &#061; 17<\/span><\/p>\n<\/p>\n<h5>4\ufe0f\u20e3\u65e5\u671f&#043;\u5929\u6570&#xff0c;-\u5929\u6570<\/h5>\n<p>     Date operator&#043;(int Days){<br \/>\n        Date ret(*this); \/\/\u62f7\u8d1d\u6784\u9020\u4e00\u4e2aret<br \/>\n        int Day_std &#061; GetMonthDay(ret._year,ret._month);<br \/>\n        ret._day &#043;&#061; Days;<br \/>\n        while (ret._day &gt; Day_std)<br \/>\n        {<br \/>\n            ret._day-&#061;Day_std;<br \/>\n            ret._month&#043;&#043;;<br \/>\n            if(ret._month&gt;12){<br \/>\n                ret._month &#061; 1;<br \/>\n                ret._year&#043;&#043;;<br \/>\n            }<br \/>\n            Day_std &#061; GetMonthDay(ret._year,ret._month);<br \/>\n        }<br \/>\n        return ret;<br \/>\n    };<\/p>\n<p>    Date operator-(int Days){<br \/>\n        Date ret(*this);<br \/>\n        int Day_std &#061; GetMonthDay(ret._year,ret._month);<br \/>\n        ret._day-&#061;Days;<br \/>\n        while(ret._day&lt;&#061;0){<br \/>\n            ret._month&#8211;;<br \/>\n            if(ret._month&lt;&#061;0){<br \/>\n                ret._month &#061; 12;<br \/>\n                ret._year&#8211;;<br \/>\n            }<br \/>\n            int Day_std &#061; GetMonthDay(ret._year,ret._month);<br \/>\n            ret._day&#043;&#061;Day_std;<br \/>\n        }<br \/>\n        return ret;<br \/>\n    }; <\/p>\n<p>\u6d4b\u8bd5\u51fd\u6570:<\/p>\n<p> int main(){<br \/>\n    \/\/\u6784\u9020\u51fd\u6570<br \/>\n    Date d2;<br \/>\n    d2.Print();<br \/>\n    Date d3(2025,8,16);<br \/>\n    Date d4 &#061; d2&#043;10;<br \/>\n    d4.Print();<br \/>\n    Date d5 &#061; d3-10;<br \/>\n    d5.Print();<br \/>\n} <\/p>\n<p>\u8f93\u51fa\u7ed3\u679c&#xff1a;<\/p>\n<p>2025-7-30 2025-8-9 2025-8-6<\/p>\n<\/p>\n<h5>5\ufe0f\u20e3. \u65e5\u671f&#043;&#061;days&#xff0c;-&#061;days<\/h5>\n<p>     Date&amp; operator-&#061;(int Days){<br \/>\n       int Day_std &#061; GetMonthDay(_year,_month);<br \/>\n        _day-&#061;Days;<br \/>\n        while(_day&lt;&#061;0){<br \/>\n            _month&#8211;;<br \/>\n            if(_month&lt;&#061;0){<br \/>\n                _month &#061; 12;<br \/>\n                _year&#8211;;<br \/>\n            }<br \/>\n            int Day_std &#061; GetMonthDay(_year,_month);<br \/>\n            _day&#043;&#061;Day_std;<br \/>\n        }<br \/>\n        return *this;<br \/>\n    };<br \/>\n\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#034;<br \/>\n    Date&amp; operator&#043;&#061;(int Days){<br \/>\n        int Day_std &#061; GetMonthDay(_year,_month);<br \/>\n        _day &#043;&#061; Days;<br \/>\n        while (_day &gt; Day_std)<br \/>\n        {<br \/>\n            _day-&#061;Day_std;<br \/>\n            _month&#043;&#043;;<br \/>\n            if(_month&gt;12){<br \/>\n                _month &#061; 1;<br \/>\n                _year&#043;&#043;;<br \/>\n            }<br \/>\n            Day_std &#061; GetMonthDay(_year,_month);<br \/>\n        }<br \/>\n        return *this;<br \/>\n    }; <\/p>\n<p>\u6d4b\u8bd5\u51fd\u6570&#xff1a;<\/p>\n<p> int main(){<br \/>\n    \/\/\u6784\u9020\u51fd\u6570<br \/>\n    Date d2;<br \/>\n    d2.Print();<br \/>\n    Date d3(2025,8,16);<br \/>\n    Date d4 &#061; d2&#043;&#061;10;<br \/>\n    d4.Print();<br \/>\n    Date d5 &#061; d3-&#061;10;<br \/>\n    d5.Print();<br \/>\n} <\/p>\n<p>\u8f93\u51fa\u63cf\u8ff0&#xff1a;<\/p>\n<p>2025-7-30 2025-8-9 2025-8-6<\/p>\n<\/p>\n<h5>6\ufe0f\u20e3. \u65e5\u671f\u7684\u524d\u7f6e&#043;&#043;&#xff0c;&#8211;&#xff0c;\u540e\u7f6e&#043;&#043;&#xff0c;&#8211;<\/h5>\n<p> \/\/\u524d\u7f6e&#043;&#043;<br \/>\n    Date&amp; operator&#043;&#043;(){<br \/>\n        int Day_std &#061; GetMonthDay(_year,_month);<br \/>\n        _day&#043;&#043;;<br \/>\n        if(_day&gt;Day_std){<br \/>\n            _day-&#061;Day_std;<br \/>\n            _month&#043;&#043;;<br \/>\n            if(_month&gt;12){<br \/>\n                _month &#061; 1;<br \/>\n                _year&#043;&#043;;<br \/>\n            }<br \/>\n        }<br \/>\n        return *this;<br \/>\n    };<br \/>\n\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#034;<br \/>\n\/\/\u540e\u7f6e&#043;&#043;<br \/>\n    Date operator&#043;&#043;(int) {<br \/>\n        Date ret(*this);  \/\/ \u4fdd\u5b58\u539f\u59cb\u503c<br \/>\n        &#043;&#043;(*this);         \/\/ \u8c03\u7528\u524d\u7f6e &#8212; \u903b\u8f91<br \/>\n        return ret;       \/\/ \u8fd4\u56de\u539f\u59cb\u503c<br \/>\n    };<br \/>\n\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#034;<br \/>\n\/\/\u524d\u7f6e&#8211;<br \/>\n    Date&amp; operator&#8211;(){<br \/>\n        _day&#8211;;<br \/>\n        if(_day&lt;&#061;0){<br \/>\n            _month&#8211;;<br \/>\n            if(_month&lt;&#061;0){<br \/>\n                _month &#061; 12;<br \/>\n                _year&#8211;;<br \/>\n            }<br \/>\n            int Day_std &#061; GetMonthDay(_year,_month);<br \/>\n            _day&#043;&#061; Day_std;<br \/>\n        }<br \/>\n        return *this;<br \/>\n    };<br \/>\n\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#034;<br \/>\n\/\/\u540e\u7f6e&#8211;<br \/>\n    Date operator&#8211;(int) {<br \/>\n        Date ret(*this);  \/\/ \u4fdd\u5b58\u539f\u59cb\u503c<br \/>\n        &#8211;(*this);         \/\/ \u8c03\u7528\u524d\u7f6e &#8212; \u903b\u8f91<br \/>\n        return ret;       \/\/ \u8fd4\u56de\u539f\u59cb\u503c<br \/>\n    }; <\/p>\n<p>\u6d4b\u8bd5\u4e3b\u51fd\u6570&#xff1a;<\/p>\n<p> int main(){<br \/>\n    Date d1(2025, 7, 30);<br \/>\n    d1.Print();       \/\/ \u8f93\u51fa&#xff1a;2025-7-30<\/p>\n<p>    Date d2 &#061; d1&#043;&#043;;<br \/>\n    d2.Print();       \/\/ \u8f93\u51fa&#xff1a;2025-7-30&#xff08;\u65e7\u503c&#xff09;<br \/>\n    d1.Print();       \/\/ \u8f93\u51fa&#xff1a;2025-7-31&#xff08;\u52a0\u4e86\u4e00\u5929&#xff09;<\/p>\n<p>    Date d3 &#061; d1&#043;&#043;;<br \/>\n    d3.Print();       \/\/ \u8f93\u51fa&#xff1a;2025-7-31&#xff08;\u65e7\u503c&#xff09;<br \/>\n    d1.Print();       \/\/ \u8f93\u51fa&#xff1a;2025-8-1&#xff08;\u8de8\u6708&#xff09;<\/p>\n<p>    Date d4 &#061; &#8211;d1;<br \/>\n    d4.Print();       \/\/ \u8f93\u51fa&#xff1a;2025-7-31<br \/>\n    d1.Print();       \/\/ \u8f93\u51fa&#xff1a;2025-7-31<\/p>\n<p>    Date d5 &#061; d1&#8211;;<br \/>\n    d5.Print();       \/\/ \u8f93\u51fa&#xff1a;2025-7-31<br \/>\n    d1.Print();       \/\/ \u8f93\u51fa&#xff1a;2025-7-30<\/p>\n<p>    return 0;<br \/>\n} <\/p>\n<p><span style=\"color:#0d0016\">\u8f93\u51fa\u7ed3\u679c&#xff1a;<\/span><\/p>\n<p><span style=\"color:#0d0016\">2025-7-30 2025-7-30 2025-7-31 2025-7-31 2025-8-1 2025-7-31 2025-7-31 2025-7-31 2025-7-30<\/span><\/p>\n<\/p>\n<p><span style=\"color:#0d0016\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5173\u4e8e\u65e5\u671f\u7c7b\u7684\u5b9e\u73b0\u6211\u4eec\u5c31\u5230\u8fd9\u91cc\u4e86\u3002<\/span><\/p>\n<p>\u672c\u8282\u5185\u5bb9\u6709\u5173\u4e8e\u62f7\u8d1d\u51fd\u6570&#xff0c;\u8fd0\u7b97\u7b26\u91cd\u8f7d\u7684\u8bb2\u89e3\u5c31\u5230\u8fd9\u4e86\u7ed3\u675f\u4e86\u3002\u62f7\u8d1d\u51fd\u6570\u4ee5\u53ca\u7c7b\u7684\u8fd0\u7b97\u7b26\u5b9a\u4e49\u662f\u975e\u5e38\u91cd\u8981\u5bf9\u4e8e\u7406\u89e3\u7c7b\u4e0e\u5bf9\u8c61\u7684\u6838\u5fc3\u77e5\u8bc6\u70b9\u3002<\/p>\n<h3>6\u3001\u603b\u7ed3<\/h3>\n<p> \u62f7\u8d1d\u6784\u9020\u51fd\u6570\u662f\u7528\u4e8e\u521b\u5efa\u5bf9\u8c61\u65f6\u7684\u521d\u59cb\u5316&#xff0c;\u800c\u8d4b\u503c\u8fd0\u7b97\u7b26\u91cd\u8f7d\u662f\u7528\u4e8e\u5bf9\u8c61\u4e4b\u95f4\u7684\u8d4b\u503c&#xff1b;\u4e24\u8005\u90fd\u662f\u5904\u7406\u201c\u5bf9\u8c61\u62f7\u8d1d\u201d\u7684\u5173\u952e\u673a\u5236&#xff0c;\u901a\u5e38\u9700\u8981\u6210\u5bf9\u5b9e\u73b0\u4ee5\u4fdd\u8bc1\u8d44\u6e90\u5b89\u5168\u3002<\/p>\n<\/p>\n<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb308\u6b21\uff0c\u70b9\u8d5e7\u6b21\uff0c\u6536\u85cf2\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86C++\u7c7b\u6210\u5458\u51fd\u6570\u4e2d\u7684\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u548c\u8fd0\u7b97\u7b26\u91cd\u8f7d\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1. \u62f7\u8d1d\u6784\u9020\u51fd\u6570\u7684\u5b9a\u4e49\u4e0e\u8c03\u7528\u65f6\u673a\uff0c\u5f3a\u8c03\u5fc5\u987b\u4f7f\u7528\u5f15\u7528\u53c2\u6570\u907f\u514d\u9012\u5f52\u8c03\u7528\uff1b2. \u6d45\u62f7\u8d1d\u548c\u6df1\u62f7\u8d1d\u7684\u533a\u522b\uff0c\u5f53\u7c7b\u5305\u542b\u6307\u9488\u6210\u5458\u65f6\u5fc5\u987b\u81ea\u5b9a\u4e49\u6df1\u62f7\u8d1d\uff1b3. \u8fd0\u7b97\u7b26\u91cd\u8f7d\u7684\u8bed\u6cd5\u548c\u5b9e\u73b0\u65b9\u6cd5\uff0c\u6f14\u793a\u4e86\u65e5\u671f\u7c7b\u7684\u6bd4\u8f83\u3001\u7b97\u672f\u548c\u81ea\u589e\u81ea\u51cf\u8fd0\u7b97\u7b26\u91cd\u8f7d\uff1b4. \u5b8c\u6574\u65e5\u671f\u7c7b\u7684\u5b9e\u73b0\uff0c\u5305\u542b\u53c2\u6570\u6821\u9a8c\u3001\u65e5\u671f\u8fd0\u7b97\u7b49\u529f\u80fd\u3002\u6587\u7ae0\u901a\u8fc7\u5177\u4f53\u4ee3\u7801\u793a\u4f8b\uff0c\u8bf4\u660e\u4e86\u5982\u4f55\u6b63\u786e\u5b9e\u73b0\u7c7b\u7684\u91cd\u8981\u6210\u5458\u51fd\u6570\uff0c\u7279\u522b\u5f3a\u8c03\u4e86\u5904\u7406\u52a8\u6001\u5185\u5b58\u65f6\u7684\u6df1\u62f7\u8d1d\u5fc5\u8981\u6027\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,174,190,3588],"topic":[],"class_list":{"0":"post-49351","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-server","7":"tag-c","9":"tag-190","10":"tag-3588"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C++\u5165\u95e8\u81ea\u5b66Day3- c++\u7c7b\u4e0e\u5bf9\u8c61\uff08\u62f7\u8d1d\u6784\u9020\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/49351.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++\u5165\u95e8\u81ea\u5b66Day3- c++\u7c7b\u4e0e\u5bf9\u8c61\uff08\u62f7\u8d1d\u6784\u9020\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb308\u6b21\uff0c\u70b9\u8d5e7\u6b21\uff0c\u6536\u85cf2\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86C++\u7c7b\u6210\u5458\u51fd\u6570\u4e2d\u7684\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u548c\u8fd0\u7b97\u7b26\u91cd\u8f7d\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1. \u62f7\u8d1d\u6784\u9020\u51fd\u6570\u7684\u5b9a\u4e49\u4e0e\u8c03\u7528\u65f6\u673a\uff0c\u5f3a\u8c03\u5fc5\u987b\u4f7f\u7528\u5f15\u7528\u53c2\u6570\u907f\u514d\u9012\u5f52\u8c03\u7528\uff1b2. \u6d45\u62f7\u8d1d\u548c\u6df1\u62f7\u8d1d\u7684\u533a\u522b\uff0c\u5f53\u7c7b\u5305\u542b\u6307\u9488\u6210\u5458\u65f6\u5fc5\u987b\u81ea\u5b9a\u4e49\u6df1\u62f7\u8d1d\uff1b3. \u8fd0\u7b97\u7b26\u91cd\u8f7d\u7684\u8bed\u6cd5\u548c\u5b9e\u73b0\u65b9\u6cd5\uff0c\u6f14\u793a\u4e86\u65e5\u671f\u7c7b\u7684\u6bd4\u8f83\u3001\u7b97\u672f\u548c\u81ea\u589e\u81ea\u51cf\u8fd0\u7b97\u7b26\u91cd\u8f7d\uff1b4. \u5b8c\u6574\u65e5\u671f\u7c7b\u7684\u5b9e\u73b0\uff0c\u5305\u542b\u53c2\u6570\u6821\u9a8c\u3001\u65e5\u671f\u8fd0\u7b97\u7b49\u529f\u80fd\u3002\u6587\u7ae0\u901a\u8fc7\u5177\u4f53\u4ee3\u7801\u793a\u4f8b\uff0c\u8bf4\u660e\u4e86\u5982\u4f55\u6b63\u786e\u5b9e\u73b0\u7c7b\u7684\u91cd\u8981\u6210\u5458\u51fd\u6570\uff0c\u7279\u522b\u5f3a\u8c03\u4e86\u5904\u7406\u52a8\u6001\u5185\u5b58\u65f6\u7684\u6df1\u62f7\u8d1d\u5fc5\u8981\u6027\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/49351.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-30T09:56:32+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/49351.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/49351.html\",\"name\":\"C++\u5165\u95e8\u81ea\u5b66Day3- c++\u7c7b\u4e0e\u5bf9\u8c61\uff08\u62f7\u8d1d\u6784\u9020\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-30T09:56:32+00:00\",\"dateModified\":\"2025-07-30T09:56:32+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/49351.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/49351.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/49351.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++\u5165\u95e8\u81ea\u5b66Day3-- c++\u7c7b\u4e0e\u5bf9\u8c61\uff08\u62f7\u8d1d\u6784\u9020\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++\u5165\u95e8\u81ea\u5b66Day3- c++\u7c7b\u4e0e\u5bf9\u8c61\uff08\u62f7\u8d1d\u6784\u9020\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/49351.html","og_locale":"zh_CN","og_type":"article","og_title":"C++\u5165\u95e8\u81ea\u5b66Day3- c++\u7c7b\u4e0e\u5bf9\u8c61\uff08\u62f7\u8d1d\u6784\u9020\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb308\u6b21\uff0c\u70b9\u8d5e7\u6b21\uff0c\u6536\u85cf2\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86C++\u7c7b\u6210\u5458\u51fd\u6570\u4e2d\u7684\u62f7\u8d1d\u6784\u9020\u51fd\u6570\u548c\u8fd0\u7b97\u7b26\u91cd\u8f7d\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1. \u62f7\u8d1d\u6784\u9020\u51fd\u6570\u7684\u5b9a\u4e49\u4e0e\u8c03\u7528\u65f6\u673a\uff0c\u5f3a\u8c03\u5fc5\u987b\u4f7f\u7528\u5f15\u7528\u53c2\u6570\u907f\u514d\u9012\u5f52\u8c03\u7528\uff1b2. \u6d45\u62f7\u8d1d\u548c\u6df1\u62f7\u8d1d\u7684\u533a\u522b\uff0c\u5f53\u7c7b\u5305\u542b\u6307\u9488\u6210\u5458\u65f6\u5fc5\u987b\u81ea\u5b9a\u4e49\u6df1\u62f7\u8d1d\uff1b3. \u8fd0\u7b97\u7b26\u91cd\u8f7d\u7684\u8bed\u6cd5\u548c\u5b9e\u73b0\u65b9\u6cd5\uff0c\u6f14\u793a\u4e86\u65e5\u671f\u7c7b\u7684\u6bd4\u8f83\u3001\u7b97\u672f\u548c\u81ea\u589e\u81ea\u51cf\u8fd0\u7b97\u7b26\u91cd\u8f7d\uff1b4. \u5b8c\u6574\u65e5\u671f\u7c7b\u7684\u5b9e\u73b0\uff0c\u5305\u542b\u53c2\u6570\u6821\u9a8c\u3001\u65e5\u671f\u8fd0\u7b97\u7b49\u529f\u80fd\u3002\u6587\u7ae0\u901a\u8fc7\u5177\u4f53\u4ee3\u7801\u793a\u4f8b\uff0c\u8bf4\u660e\u4e86\u5982\u4f55\u6b63\u786e\u5b9e\u73b0\u7c7b\u7684\u91cd\u8981\u6210\u5458\u51fd\u6570\uff0c\u7279\u522b\u5f3a\u8c03\u4e86\u5904\u7406\u52a8\u6001\u5185\u5b58\u65f6\u7684\u6df1\u62f7\u8d1d\u5fc5\u8981\u6027\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/49351.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-30T09:56:32+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"9 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/49351.html","url":"https:\/\/www.wsisp.com\/helps\/49351.html","name":"C++\u5165\u95e8\u81ea\u5b66Day3- c++\u7c7b\u4e0e\u5bf9\u8c61\uff08\u62f7\u8d1d\u6784\u9020\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-30T09:56:32+00:00","dateModified":"2025-07-30T09:56:32+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/49351.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/49351.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/49351.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"C++\u5165\u95e8\u81ea\u5b66Day3-- c++\u7c7b\u4e0e\u5bf9\u8c61\uff08\u62f7\u8d1d\u6784\u9020\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/49351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=49351"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/49351\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=49351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=49351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=49351"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=49351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}