{"id":184,"date":"2021-03-30T09:32:22","date_gmt":"2021-03-30T01:32:22","guid":{"rendered":"https:\/\/blogs.gongqilin.cn\/?p=184"},"modified":"2021-03-30T09:32:22","modified_gmt":"2021-03-30T01:32:22","slug":"%e7%bb%93%e6%9e%84%e4%bd%93%e9%87%8d%e8%bd%bd%e8%bf%90%e7%ae%97%e7%ac%a6%e5%a4%a7%e5%85%a8%ef%bc%88%e8%bf%90%e7%ae%97%e3%80%81%e6%af%94%e8%be%83%e3%80%81%e8%b5%8b%e5%80%bc%e3%80%81%e8%be%93%e5%85%a5","status":"publish","type":"post","link":"https:\/\/blogs.gongqilin.cn\/?p=184","title":{"rendered":"\u7ed3\u6784\u4f53\u91cd\u8f7d\u8fd0\u7b97\u7b26\u5927\u5168\uff08\u8fd0\u7b97\u3001\u6bd4\u8f83\u3001\u8d4b\u503c\u3001\u8f93\u5165\u8f93\u51fa\uff09"},"content":{"rendered":"<p>\u8fd0\u7b97\uff1a+, -, *, \/, +=\u7b49\u7b49<br \/>\n\u6bd4\u8f83\uff1a&gt;, = ,&lt;, \u2265, \u2264, ==, !=\u7b49<br \/>\n\u8d4b\u503c\uff1a=<br \/>\n\u8f93\u5165\uff1a&gt;&gt;<br \/>\n\u8f93\u51fa\uff1a&lt;&lt;<\/p>\n<p>\u6587\u7ae0\u8f6c\u8f7d\u4e8e<a href=\"https:\/\/blog.csdn.net\/weixin_43899069\/article\/details\/104442108\">https:\/\/blog.csdn.net\/weixin_43899069\/article\/details\/104442108<\/a><\/p>\n<pre class=\"prettyprint linenums\">#include\r\n#include\r\nusing namespace std; \r\n\r\nstruct Point {\r\n\tint x, y;\r\n\tPoint(int x = 0, int y = 0): x(x), y(y) {}\r\n\t\r\n\t\/\/\u91cd\u8f7d\u7b97\u672f\u8fd0\u7b97\u7b26(- * \/ +=\u540c\u7406)\r\n\tPoint operator + (const Point&amp; A) {\r\n\t\tx += A.x;\r\n\t\ty += A.y;\r\n\t\treturn *this; \r\n\t} \r\n\t\r\n\t\/\/\u91cd\u8f7d\u6bd4\u8f83\u8fd0\u7b97\u7b26(&lt; == != \u540c\u7406) bool operator &gt; (const Point&amp; A) {\r\n\t\treturn x &gt; A.x;\t\t\t\t\t\t\t\t \r\n\t}\r\n\t\r\n\t\/\/\u91cd\u8f7d\u8d4b\u503c\u8fd0\u7b97\u7b26\r\n\tPoint operator = (const Point&amp; A) {\r\n\t\tx = A.x;\r\n\t\ty = A.y;\r\n\t\treturn *this; \r\n\t} \r\n\t\t\r\n\t\/\/\u91cd\u8f7d\u8f93\u5165\u8f93\u51fa\u8fd0\u7b97\u7b26 \r\n\tfriend istream&amp; operator &gt;&gt; (istream&amp; in, Point&amp; P) {\r\n\t\tin &gt;&gt; P.x &gt;&gt; P.y;\r\n\t\treturn in;\r\n\t}\r\n\t\r\n\t\/\/\u91cd\u8f7d\u8f93\u51fa\u8fd0\u7b97\u7b26\r\n\tfriend ostream&amp; operator &lt;&lt; (ostream&amp;, const Point&amp; P) {\r\n\t\tcout &lt;&lt; &quot;(&quot; &lt;&lt; P.x &lt;&lt; &quot;,&quot; &lt;&lt; P.y &lt;&lt; &quot;)&quot;;\r\n\t\treturn cout;\r\n\t} \r\n\t\t \r\n}point[10];\t\t\t\t\t\t\t\t\t\t\t\/\/\u7ed3\u6784\u4f53\u6570\u7ec4 \r\n\r\nint main()\r\n{\r\n\t\/\/\u521b\u5efa \r\n\tPoint a(5,4), b(4,2);\t\t\t\t\t\/\/\u6784\u9020\u51fd\u6570\u521b\u5efa\u7ed3\u6784\u4f53 \r\n\tpoint[0].x = 2 ; point[0].y = 4;\t\t\/\/\u7ed3\u6784\u4f53\u6570\u7ec4\u521b\u5efa\u7ed3\u6784\u4f53\r\n\tpoint[1].x = 1 ; point[1].y = 4;\r\n\t\r\n\t\/\/\u7b97\u672f\u8fd0\u7b97\u7b26\r\n\tpoint[1] = point[1]+point[0];\t\t\r\n\t\r\n\t\/\/\u6bd4\u8f83\u8fd0\u7b97\u7b26\t\t\t\r\n\tcout &lt;&lt; (point[0]&gt;point[1]) &lt;&lt; endl;\t\t\t\t\r\n\t\r\n\t\/\/\u8d4b\u503c\u8fd0\u7b97\u7b26\uff1a\r\n\tpoint[2] = point[1];\r\n\tcout &lt;&lt; point[2] &lt;&lt; endl; \/\/\u8f93\u5165\u8fd0\u7b97\u7b26 cin &gt;&gt; point[5]; \r\n\t \r\n\t\/\/\u8f93\u51fa\u8fd0\u7b97\u7b26 \r\n\tcout &lt;&lt; point[5]; \r\n\treturn 0;\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd0\u7b97\uff1a+, -, *, \/, +=\u7b49\u7b49 \u6bd4\u8f83\uff1a&gt;, = ,&lt;, \u2265, \u2264, ==, !=\u7b49 \u8d4b\u503c\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-184","post","type-post","status-publish","format-standard","hentry","category-c"],"_links":{"self":[{"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=\/wp\/v2\/posts\/184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=184"}],"version-history":[{"count":3,"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=\/wp\/v2\/posts\/184\/revisions"}],"predecessor-version":[{"id":187,"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=\/wp\/v2\/posts\/184\/revisions\/187"}],"wp:attachment":[{"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gongqilin.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}