{"id":154,"date":"2003-08-07T22:50:36","date_gmt":"2003-08-07T22:50:36","guid":{"rendered":"http:\/\/ellery.no-ip.info\/wp\/thinkingmore\/2003\/08\/07\/c%e4%b9%8b%e4%ba%ba%e7%94%9f\/"},"modified":"2003-08-07T22:50:36","modified_gmt":"2003-08-07T22:50:36","slug":"c%e4%b9%8b%e4%ba%ba%e7%94%9f","status":"publish","type":"post","link":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/2003\/08\/c%e4%b9%8b%e4%ba%ba%e7%94%9f\/","title":{"rendered":"C++\u4e4b\u4eba\u751f"},"content":{"rendered":"<pre>\n#include &lt;iostream&gt;\n#include &lt;string&gt;\n#include &lt;cstdio&gt;\n#include &lt;cstdlib&gt;\n#include &lt;adodb.h&gt;\t\/\/ CRecordset is defined here.\ntypedef int \u6210\u719f\u5ea6;\n#define RANDOM( max )\t( (int)(max*rand()\/RAND_MAX) )\nclass CPerson {\npublic:\nint \u5e74\u9f61,\u4eba\u8108,\u610f\u5fd7;\nbool \u6200\u611b,\u61f7\u5b55;\nlong long \u91d1\u9322;\n\u6210\u719f\u5ea6 \u6280\u8853;\nCRecordset \u5c65\u6b77\u8868;\nstring \u6027\u5225;\nCPerson \u914d\u5076,\u7236,\u6bcd,\u5973\u53cb;\npublic:\nCPerson() {}\n};\nbool\nis\u5bb6\u6709\u9322( CPerson&amp; p ) {\nif( (person.\u7236.\u91d1\u9322+person.\u6bcd.\u91d1\u9322)&gt;10000000 )\nreturn true;\nelse\nreturn false;\n}\nbool\nis\u58ae\u80ce( CPerson&amp; p ) {\n\/\/ \u4e0d\u53ef\u9810\u671f\nrandomize();\nreturn RANDOM( 1 );\n}\nbool\nis\u9b27\u5f88\u5927( CPerson&amp; p ) {\n\/\/ \u4e0d\u53ef\u9810\u671f\nrandomize();\nreturn RANDOM( 1 );\n}\nbool\ncan\u7d50\u5a5a() {\n\/\/\u6709\u9452\u65bc\u76ee\u524d\u793e\u6703\u7684\u4e00\u4e9b\u73fe\u6cc1,\n\/\/\u8abf\u6574\u6700\u4f4e\u5e74\u9f61\u70ba15,\u6700\u9ad8\u5e74\u9f61\u70ba\u7121\nif( person.\u5e74\u9f61 &gt; 15 )\nif( has\u9069\u7576\u5c0d\u8c61()\n&amp;&amp; person.\u6200\u611b==true )\nreturn true;\nreturn false;\n}\nint\n\u7d50\u5a5a() {\n\/\/ nothing special\n}\nbool\nisEnough( CPerson&amp; p ) {\nif( p.\u6200\u611b==true ) {\nif( p.\u5973\u53cb.\u61f7\u5b55==true &amp;&amp;\nis\u58ae\u80ce(p.\u5973\u53cb)==false\n&amp;&amp; is\u9b27\u5f88\u5927()==true ) {\nif( can\u7d50\u5a5a() )\n\u7d50\u5a5a();\nreturn true;\n}\n}\nif( is\u5bb6\u6709\u9322()==false )\nreturn true;\nif( \u610f\u5fd7==0 )\nreturn true;\nreturn false;\n}\nint\n\u6c42\u5b78() {\n\/\/ nothing special\n}\nint\n\u670d\u5f79() {\n\/\/ nothing special\n}\nint\n\u4e0a\u73ed() {\nif( \u5be6\u529b\u4e0d\u8db3() )\n\u57f9\u990a\u5be6\u529b();\nelse {\nif( \u85aa\u6c34 &lt; \u80fd\u529b\n&amp;&amp; \u6709\u66f4\u597d\u7684\u6a5f\u6703()==true )\n\u8df3\u69fd();\nelse if( \u85aa\u6c34 &gt;= \u80fd\u529b )\t\/\/\u6eff\u610f\nNULL;\t\/\/ do nothing\nelse if( \u85aa\u6c34 &lt; \u80fd\u529b\n&amp;&amp; \u6709\u66f4\u597d\u7684\u6a5f\u6703()==false )\n\u8a8d\u547d();\n}\nif( \u9322 &gt; (\u9322 + \u4e4b\u524d\u7684\u9322) &amp;&amp; \u9592 = true )\n\u5ea6\u5047\u4f11\u606f();\nif( can\u7d50\u5a5a()==true )\n\u7d50\u5a5a();\nif( has\u6a5f\u6703() )\n\u5275\u696d();\nelse\n\u4f5c\u54c8\u5df4\u72d7();\n}\nint\nmain() {\nCPerson person=\u4eba_\u51fa\u751f();\nif( is\u5bb6\u6709\u9322( person ) )\nexit( EXIT_FAILURE );\nelse {\nwhile( isEnough( person )==false )\n\u6c42\u5b78();\nif( person.sex==string(\"\u7537\") )\n\u670d\u5f79();\nwhile( isDead( person )==false )\n\u4e0a\u73ed();\n}\n\/\/ The person is dead,\n\/\/ C++ will release person automatically.\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;cstdio&gt; #include &lt;cstdlib&gt; #include &lt;adodb.h&gt; \/\/ CRecordset is defined here. typedef int \u6210\u719f\u5ea6; #define RANDOM( max ) ( (int)(max*rand()\/RAND_MAX) ) class CPerson { public: int \u5e74\u9f61,\u4eba\u8108,\u610f\u5fd7; bool \u6200\u611b,\u61f7\u5b55; long long \u91d1\u9322; \u6210\u719f\u5ea6 \u6280\u8853; CRecordset \u5c65\u6b77\u8868; string \u6027\u5225; CPerson \u914d\u5076,\u7236,\u6bcd,\u5973\u53cb; public: CPerson() {} }; bool is\u5bb6\u6709\u9322( CPerson&amp; p ) { if( &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/2003\/08\/c%e4%b9%8b%e4%ba%ba%e7%94%9f\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;C++\u4e4b\u4eba\u751f&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[9],"tags":[],"class_list":["post-154","post","type-post","status-publish","format-standard","hentry","category-9"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2MOxp-2u","_links":{"self":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts\/154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/comments?post=154"}],"version-history":[{"count":0,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/posts\/154\/revisions"}],"wp:attachment":[{"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/media?parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/categories?post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ellery.no-ip.info\/wp\/thinkingmore\/wp-json\/wp\/v2\/tags?post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}