{"id":307138,"date":"2024-05-20T20:28:05","date_gmt":"2024-05-20T12:28:05","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/307138.html"},"modified":"2024-05-20T20:28:24","modified_gmt":"2024-05-20T12:28:24","slug":"c-%e8%af%ad%e8%a8%80%e4%bb%8e%e9%94%ae%e7%9b%98%e4%b8%8a%e8%be%93%e5%85%a5%e7%9b%b4%e7%ba%bf%e6%96%b9%e7%a8%8b%ef%bc%8c%e5%a6%82%e4%bd%95%e6%b1%82%e4%ba%a4%e7%82%b9%e5%9d%90%e6%a0%87","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/307138.html","title":{"rendered":"C \u8bed\u8a00\u4ece\u952e\u76d8\u4e0a\u8f93\u5165\u76f4\u7ebf\u65b9\u7a0b\uff0c\u5982\u4f55\u6c42\u4ea4\u70b9\u5750\u6807"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/26223453\/8b0c2bd6-cdfb-4bde-b936-5036cb9d89f5.webp\" alt=\"C \u8bed\u8a00\u4ece\u952e\u76d8\u4e0a\u8f93\u5165\u76f4\u7ebf\u65b9\u7a0b\uff0c\u5982\u4f55\u6c42\u4ea4\u70b9\u5750\u6807\" \/><\/p>\n<p><p>C\u8bed\u8a00\u4ece\u952e\u76d8\u4e0a\u8f93\u5165\u76f4\u7ebf\u65b9\u7a0b\uff0c<strong>\u6c42\u4ea4\u70b9\u5750\u6807\u9700\u91c7\u53d6\u4ee5\u4e0b\u6b65\u9aa4<\/strong>\uff1a<strong>\u5148\u89e3\u6790\u65b9\u7a0b\u5f0f\u3001\u7136\u540e\u8bbe\u7f6e\u65b9\u7a0b\u53c2\u6570\u3001\u7d27\u63a5\u7740\u5229\u7528\u6570\u5b66\u516c\u5f0f\u8ba1\u7b97\u4ea4\u70b9\u5750\u6807<\/strong>\uff0c\u6700\u540e\u8f93\u51fa\u7ed3\u679c\u3002\u89e3\u6790\u65b9\u7a0b\u5f0f\u662f\u5173\u952e\u6b65\u9aa4\uff0c\u6d89\u53ca\u5c06\u7528\u6237\u8f93\u5165\u7684\u65b9\u7a0b\u5f0f\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u7a0b\u5e8f\u53ef\u64cd\u4f5c\u7684\u6570\u5b66\u8868\u8fbe\u5f0f\u3002\u5177\u4f53\u800c\u8a00\uff0c\u8fd9\u901a\u5e38\u901a\u8fc7\u5b57\u7b26\u4e32\u5904\u7406\u548c\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u6765\u5b9e\u73b0\uff0c\u63d0\u53d6\u65b9\u7a0b\u4e2d\u7684\u7cfb\u6570\u548c\u5e38\u6570\u9879\uff0c\u8f6c\u6362\u4e3aC\u8bed\u8a00\u4e2d\u7684\u53d8\u91cf\u503c\u3002\u8fd9\u4e0d\u4ec5\u8981\u6c42\u7a0b\u5e8f\u80fd\u591f\u7406\u89e3\u591a\u79cd\u8868\u793a\u5f62\u5f0f\u7684\u65b9\u7a0b\uff08\u5982\u659c\u622a\u5f0f\u3001\u70b9\u659c\u5f0f\u7b49\uff09\uff0c\u8fd8\u9700\u8981\u8db3\u591f\u7684\u9519\u8bef\u68c0\u67e5\u673a\u5236\u6765\u5904\u7406\u8f93\u5165\u9519\u8bef\u6216\u975e\u6807\u51c6\u65b9\u7a0b\u5f0f\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u89e3\u6790\u952e\u76d8\u8f93\u5165<\/h3>\n<\/p>\n<p><p>\u5728\u7f16\u5199C\u4ee3\u7801\u4ee5\u4ece\u952e\u76d8\u63a5\u6536\u65b9\u7a0b\u8f93\u5165\u65f6\uff0c\u9996\u5148\u9700\u8981\u901a\u8fc7<code>scanf<\/code>\u6216<code>gets<\/code>\u51fd\u6570\u6765\u8bfb\u53d6\u7528\u6237\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u3002\u5047\u8bbe\u6211\u4eec\u8981\u6c42\u89e3\u4e24\u6761\u76f4\u7ebf\u7684\u4ea4\u70b9\uff0c\u7528\u6237\u9700\u8981\u8f93\u5165\u4e24\u6761\u76f4\u7ebf\u7684\u65b9\u7a0b\u3002\u5bf9\u4e8e\u6807\u51c6\u7684\u659c\u7387-\u622a\u8ddd\u5f62\u5f0f\uff08y = mx + b\uff09\uff0c\u6211\u4eec\u7684\u76ee\u6807\u662f\u4ece\u8fd9\u4e9b\u5b57\u7b26\u4e32\u4e2d\u63d0\u53d6\u659c\u7387\uff08m\uff09\u548c\u622a\u8ddd\uff08b\uff09\u7684\u503c\u3002<\/p>\n<\/p>\n<p><p>\u4e3a\u6b64\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<code>sscanf<\/code>\u51fd\u6570\u6765\u5339\u914d\u5e76\u63d0\u53d6\u8f93\u5165\u5b57\u7b26\u4e32\u4e2d\u7684\u6570\u503c\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u7528\u6237\u8f93\u5165\u7684\u65b9\u7a0b\u53ef\u80fd\u4f1a\u6709\u591a\u79cd\u683c\u5f0f\uff0c\u56e0\u6b64\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5bf9\u8f93\u5165\u5b57\u7b26\u4e32\u8fdb\u884c\u9884\u5904\u7406\uff08\u5982\u53bb\u9664\u7a7a\u683c\u3001\u7edf\u4e00\u5927\u5199\u6216\u5c0f\u5199\uff09\u4f1a\u662f\u4e00\u4e2a\u597d\u4e60\u60ef\uff0c\u4ee5\u51cf\u5c11\u5904\u7406\u7684\u590d\u6742\u6027\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u8bbe\u7f6e\u65b9\u7a0b\u53c2\u6570<\/h3>\n<\/p>\n<p><p>\u63d0\u53d6\u51fa\u659c\u7387\u548c\u622a\u8ddd\u540e\uff0c\u4e0b\u4e00\u6b65\u662f\u5c06\u5b83\u4eec\u8bbe\u7f6e\u4e3a\u65b9\u7a0b\u53c2\u6570\u3002\u5728C\u7a0b\u5e8f\u4e2d\uff0c\u8fd9\u610f\u5473\u7740\u5c06\u8fd9\u4e9b\u503c\u5b58\u50a8\u5728\u53d8\u91cf\u4e2d\u3002\u56e0\u4e3a\u6211\u4eec\u662f\u5728\u5904\u7406\u4e24\u6761\u76f4\u7ebf\uff0c\u6240\u4ee5\u81f3\u5c11\u9700\u8981\u56db\u4e2a\u53d8\u91cf\uff1a\u4e24\u4e2a\u7528\u4e8e\u5b58\u50a8\u659c\u7387\uff08m1\u548cm2\uff09\u548c\u4e24\u4e2a\u7528\u4e8e\u5b58\u50a8\u622a\u8ddd\uff08b1\u548cb2\uff09\u3002<\/p>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u4ee3\u7801\u5b9e\u73b0\u65f6\uff0c\u8fd8\u9700\u8981\u8003\u8651\u76f4\u7ebf\u65b9\u7a0b\u53ef\u80fd\u4e0d\u5b8c\u5168\u9075\u5faa\u659c\u7387-\u622a\u8ddd\u5f62\u5f0f\u7684\u60c5\u666f\uff08\u4f8b\u5982\uff0c\u5782\u76f4\u4e8ey\u8f74\u7684\u76f4\u7ebf\uff0c\u5176\u65b9\u7a0b\u5f62\u5f0f\u4e3ax = c\uff09\u3002\u8fd9\u610f\u5473\u7740\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u9700\u8981\u901a\u8fc7\u4e0d\u540c\u7684\u7b56\u7565\u6765\u89e3\u6790\u65b9\u7a0b\u5e76\u8bbe\u7f6e\u53c2\u6570\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u8ba1\u7b97\u4ea4\u70b9\u5750\u6807<\/h3>\n<\/p>\n<p><p>\u4e00\u65e6\u62e5\u6709\u76f4\u7ebf\u65b9\u7a0b\u7684\u53c2\u6570\uff08\u5373\u659c\u7387\u548c\u622a\u8ddd\uff09\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u6570\u5b66\u516c\u5f0f\u6765\u8ba1\u7b97\u4ea4\u70b9\u5750\u6807\u3002\u5bf9\u4e8e\u4e24\u6761\u76f4\u7ebf\uff1ay = m1x + b1\u548cy = m2x + b2\uff0c\u5176\u4ea4\u70b9\u5750\u6807\uff08x\uff0cy\uff09\u53ef\u4ee5\u901a\u8fc7\u89e3\u4ee5\u4e0b\u65b9\u7a0b\u7ec4\u83b7\u5f97\uff1a<\/p>\n<\/p>\n<p><p>[x = \\frac{b2 &#8211; b1}{m1 &#8211; m2}]<\/p>\n<\/p>\n<p><p>[y = m1 * x + b1]<\/p>\n<\/p>\n<p><p>\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5982\u679c\u4e24\u6761\u76f4\u7ebf\u5e73\u884c\uff08\u5373\u659c\u7387\u76f8\u7b49\uff0cm1 = m2\uff09\uff0c\u90a3\u4e48\u8fd9\u4e24\u6761\u76f4\u7ebf\u4e0d\u4f1a\u6709\u4ea4\u70b9\uff08\u6216\u8005\u5728\u7279\u6b8a\u60c5\u51b5\u4e0b\uff0c\u5f53b1 = b2\u65f6\uff0c\u8fd9\u4e24\u6761\u76f4\u7ebf\u91cd\u5408\uff09\u3002<\/p>\n<\/p>\n<p><p>\u5728C\u7a0b\u5e8f\u4e2d\uff0c\u8ba1\u7b97\u4ea4\u70b9\u5750\u6807\u9996\u5148\u9700\u8981\u68c0\u67e5\u659c\u7387\u662f\u5426\u76f8\u7b49\uff0c\u4ece\u800c\u907f\u514d\u9664\u4ee5\u96f6\u7684\u9519\u8bef\u3002\u5176\u6b21\uff0c\u4f7f\u7528\u4e0a\u9762\u7684\u516c\u5f0f\u8ba1\u7b97x\u548cy\u7684\u503c\uff0c\u5e76\u5c06\u7ed3\u679c\u5b58\u50a8\u5728\u53d8\u91cf\u4e2d\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u8f93\u51fa\u7ed3\u679c<\/h3>\n<\/p>\n<p><p>\u8ba1\u7b97\u51fa\u4ea4\u70b9\u5750\u6807\u540e\uff0c\u6700\u540e\u4e00\u6b65\u662f\u5411\u7528\u6237\u663e\u793a\u8fd9\u4e9b\u5750\u6807\u3002\u8fd9\u53ef\u4ee5\u901a\u8fc7<code>printf<\/code>\u51fd\u6570\u5b9e\u73b0\uff0c\u683c\u5f0f\u5316\u8f93\u51fax\u548cy\u7684\u503c\u3002<\/p>\n<\/p>\n<p><p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u8f93\u51fa\u7ed3\u679c\u4e4b\u524d\uff0c\u6700\u597d\u5bf9\u7ed3\u679c\u8fdb\u884c\u68c0\u67e5\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4e24\u6761\u76f4\u7ebf\u5e73\u884c\uff08\u6ca1\u6709\u4ea4\u70b9\uff09\uff0c\u7a0b\u5e8f\u5e94\u8f93\u51fa\u76f8\u5e94\u7684\u63d0\u793a\u4fe1\u606f\u800c\u4e0d\u662f\u65e0\u610f\u4e49\u7684\u5750\u6807\u503c\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\u5b9e\u73b0\u7684C\u8bed\u8a00\u7a0b\u5e8f\u80fd\u591f\u63a5\u6536\u7528\u6237\u8f93\u5165\u7684\u4e24\u6761\u76f4\u7ebf\u65b9\u7a0b\uff0c\u5e76\u51c6\u786e\u8ba1\u7b97\u51fa\u5b83\u4eec\u7684\u4ea4\u70b9\u5750\u6807\uff08\u5982\u679c\u5b58\u5728\uff09\u3002\u8fd9\u4e0d\u4ec5\u8003\u9a8c\u4e86\u7a0b\u5e8f\u5458\u5bf9C\u8bed\u8a00\u7684\u638c\u63e1\uff0c\u540c\u65f6\u4e5f\u9700\u8981\u826f\u597d\u7684\u6570\u5b66\u57fa\u7840\u548c\u903b\u8f91\u601d\u7ef4\u80fd\u529b\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u5982\u4f55\u5728 C \u8bed\u8a00\u4e2d\u5b9e\u73b0\u4ece\u952e\u76d8\u4e0a\u8f93\u5165\u76f4\u7ebf\u65b9\u7a0b\u7684\u529f\u80fd\uff1f<\/strong><\/p>\n<p>\u5728 C \u8bed\u8a00\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528 scanf \u51fd\u6570\u6765\u4ece\u952e\u76d8\u4e0a\u83b7\u53d6\u7528\u6237\u8f93\u5165\u7684\u76f4\u7ebf\u65b9\u7a0b\u3002\u9996\u5148\uff0c\u4f60\u9700\u8981\u5b9a\u4e49\u4e00\u4e2a\u5b57\u7b26\u6570\u7ec4\u53d8\u91cf\u6765\u5b58\u50a8\u7528\u6237\u8f93\u5165\u7684\u65b9\u7a0b\u4fe1\u606f\uff0c\u7136\u540e\u4f7f\u7528 scanf \u51fd\u6570\u5c06\u7528\u6237\u8f93\u5165\u7684\u65b9\u7a0b\u5b58\u50a8\u5230\u8be5\u5b57\u7b26\u6570\u7ec4\u4e2d\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u6765\u5b9e\u73b0\u8be5\u529f\u80fd\uff1a<\/p>\n<pre><code class=\"language-c\">#include &lt;stdio.h&gt;\n\nint m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n() {\n    char equation[100];\n    \n    printf(&quot;\u8bf7\u8f93\u5165\u76f4\u7ebf\u65b9\u7a0b\uff1a&quot;);\n    scanf(&quot;%s&quot;, equation);\n    \n    printf(&quot;\u4f60\u8f93\u5165\u7684\u76f4\u7ebf\u65b9\u7a0b\u662f\uff1a%s\\n&quot;, equation);\n    \n    return 0;\n}\n<\/code><\/pre>\n<p><strong>2. \u5982\u4f55\u901a\u8fc7 C \u8bed\u8a00\u8ba1\u7b97\u76f4\u7ebf\u65b9\u7a0b\u7684\u4ea4\u70b9\u5750\u6807\uff1f<\/strong><\/p>\n<p>\u4e00\u65e6\u4f60\u6210\u529f\u83b7\u53d6\u4e86\u7528\u6237\u8f93\u5165\u7684\u76f4\u7ebf\u65b9\u7a0b\uff0c\u4f60\u5c31\u53ef\u4ee5\u4f7f\u7528 C \u8bed\u8a00\u8fdb\u884c\u8ba1\u7b97\u4ee5\u83b7\u5f97\u4ea4\u70b9\u7684\u5750\u6807\u3002\u8981\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\uff0c\u4f60\u9700\u8981\u89e3\u6790\u65b9\u7a0b\u7684\u659c\u7387\u548c\u622a\u8ddd\uff0c\u5e76\u5c06\u5176\u5e94\u7528\u5230\u6c42\u4ea4\u70b9\u7684\u516c\u5f0f\u4e2d\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8e\u4e00\u6761\u76f4\u7ebf\u7684\u6807\u51c6\u65b9\u7a0b y = mx + b\uff0c\u5176\u4e2d m \u8868\u793a\u659c\u7387\uff0cb \u8868\u793a\u622a\u8ddd\uff0c\u6211\u4eec\u53ef\u4ee5\u8ba1\u7b97\u4e24\u6761\u76f4\u7ebf\u7684\u4ea4\u70b9\u5750\u6807\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u7a0b\u5e8f\uff0c\u5b83\u80fd\u591f\u8ba1\u7b97\u4e24\u6761\u76f4\u7ebf\u7684\u4ea4\u70b9\u5750\u6807\uff1a<\/p>\n<pre><code class=\"language-c\">#include &lt;stdio.h&gt;\n\ntypedef struct Point {\n    double x;\n    double y;\n} Point;\n\nPoint getIntersectionPoint(double m1, double b1, double m2, double b2) {\n    Point intersection;\n    \n    if (m1 == m2) {\n        printf(&quot;\u8fd9\u4e24\u6761\u76f4\u7ebf\u5e73\u884c\uff0c\u6ca1\u6709\u4ea4\u70b9\u3002\\n&quot;);\n        intersection.x = -9999;\n        intersection.y = -9999;\n    } else {\n        intersection.x = (b2 - b1) \/ (m1 - m2);\n        intersection.y = m1 * intersection.x + b1;\n    }\n    \n    return intersection;\n}\n\nint main() {\n    double m1, b1, m2, b2;\n    \n    printf(&quot;\u8bf7\u8f93\u5165\u7b2c\u4e00\u6761\u76f4\u7ebf\u7684\u659c\u7387\u548c\u622a\u8ddd\uff1a&quot;);\n    scanf(&quot;%lf %lf&quot;, &amp;m1, &amp;b1);\n    \n    printf(&quot;\u8bf7\u8f93\u5165\u7b2c\u4e8c\u6761\u76f4\u7ebf\u7684\u659c\u7387\u548c\u622a\u8ddd\uff1a&quot;);\n    scanf(&quot;%lf %lf&quot;, &amp;m2, &amp;b2);\n    \n    Point intersection = getIntersectionPoint(m1, b1, m2, b2);\n    \n    if (intersection.x != -9999 &amp;&amp; intersection.y != -9999) {\n        printf(&quot;\u4e24\u6761\u76f4\u7ebf\u7684\u4ea4\u70b9\u5750\u6807\u4e3a\uff1a(%.2lf, %.2lf)\\n&quot;, intersection.x, intersection.y);\n    }\n    \n    return 0;\n}\n<\/code><\/pre>\n<p><strong>3. C \u8bed\u8a00\u4e2d\u5982\u4f55\u5904\u7406\u76f4\u7ebf\u65b9\u7a0b\u4e0d\u5408\u6cd5\u6216\u8f93\u5165\u9519\u8bef\u7684\u60c5\u51b5\uff1f<\/strong><\/p>\n<p>\u5728\u4f7f\u7528 C \u8bed\u8a00\u5904\u7406\u76f4\u7ebf\u65b9\u7a0b\u65f6\uff0c\u6211\u4eec\u5e94\u8be5\u8003\u8651\u5230\u53ef\u80fd\u51fa\u73b0\u65b9\u7a0b\u4e0d\u5408\u6cd5\u6216\u8f93\u5165\u9519\u8bef\u7684\u60c5\u51b5\u3002\u4f8b\u5982\uff0c\u5982\u679c\u7528\u6237\u8f93\u5165\u7684\u65b9\u7a0b\u4e0d\u662f\u6807\u51c6\u7684\u76f4\u7ebf\u65b9\u7a0b\u6216\u8f93\u5165\u7684\u659c\u7387\u65e0\u6548\u7b49\u60c5\u51b5\uff0c\u6211\u4eec\u9700\u8981\u8fdb\u884c\u9519\u8bef\u5904\u7406\u3002<\/p>\n<p>\u4e00\u79cd\u5e38\u89c1\u7684\u9519\u8bef\u5904\u7406\u65b9\u6cd5\u662f\u901a\u8fc7\u68c0\u67e5\u7528\u6237\u8f93\u5165\u7684\u76f4\u7ebf\u65b9\u7a0b\u662f\u5426\u7b26\u5408\u8981\u6c42\u6765\u9a8c\u8bc1\u65b9\u7a0b\u7684\u5408\u6cd5\u6027\u3002\u5982\u679c\u65b9\u7a0b\u4e0d\u7b26\u5408\u8981\u6c42\uff0c\u6211\u4eec\u53ef\u4ee5\u5411\u7528\u6237\u663e\u793a\u9519\u8bef\u6d88\u606f\u5e76\u8981\u6c42\u91cd\u65b0\u8f93\u5165\u3002\u540c\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u6761\u4ef6\u8bed\u53e5\uff08\u4f8b\u5982 if-else \u8bed\u53e5\uff09\u6765\u68c0\u6d4b\u9519\u8bef\uff0c\u5e76\u5408\u7406\u5730\u5904\u7406\u8fd9\u4e9b\u9519\u8bef\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u7a0b\u5e8f\uff0c\u5b83\u6f14\u793a\u4e86\u5982\u4f55\u5904\u7406\u76f4\u7ebf\u65b9\u7a0b\u4e0d\u5408\u6cd5\u6216\u8f93\u5165\u9519\u8bef\u7684\u60c5\u51b5\uff1a<\/p>\n<pre><code class=\"language-c\">#include &lt;stdio.h&gt;\n\nint main() {\n    double m, b;\n    int validEquation = 0;\n    \n    printf(&quot;\u8bf7\u8f93\u5165\u76f4\u7ebf\u65b9\u7a0b\u7684\u659c\u7387\u548c\u622a\u8ddd\uff1a&quot;);\n    if (scanf(&quot;%lf %lf&quot;, &amp;m, &amp;b) != 2) {\n        printf(&quot;\u8f93\u5165\u7684\u76f4\u7ebf\u65b9\u7a0b\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\uff01\\n&quot;);\n        validEquation = 0; \/\/ \u65b9\u7a0b\u65e0\u6548\n    } else {\n        validEquation = 1; \/\/ \u65b9\u7a0b\u6709\u6548\n    }\n    \n    if (validEquation) {\n        \/\/ \u540e\u7eed\u5904\u7406\n        printf(&quot;\u65b9\u7a0b\u6709\u6548\uff0c\u53ef\u4ee5\u8fdb\u884c\u8ba1\u7b97\u3002\\n&quot;);\n    }\n    \n    return 0;\n}\n<\/code><\/pre>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u7a0b\u5e8f\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u4f7f\u7528 scanf \u51fd\u6570\u4ece\u952e\u76d8\u4e0a\u83b7\u53d6\u7528\u6237\u8f93\u5165\u7684\u76f4\u7ebf\u65b9\u7a0b\u3002\u7136\u540e\uff0c\u6211\u4eec\u4f7f\u7528\u6761\u4ef6\u8bed\u53e5\u6765\u68c0\u67e5\u65b9\u7a0b\u7684\u6709\u6548\u6027\u3002\u5982\u679c\u8f93\u5165\u7684\u65b9\u7a0b\u65e0\u6548\uff0c\u7a0b\u5e8f\u4f1a\u5411\u7528\u6237\u663e\u793a\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u8981\u6c42\u91cd\u65b0\u8f93\u5165\u3002\u5982\u679c\u65b9\u7a0b\u6709\u6548\uff0c\u7a0b\u5e8f\u5c06\u7ee7\u7eed\u6267\u884c\u540e\u7eed\u7684\u8ba1\u7b97\u6216\u5904\u7406\u6b65\u9aa4\u3002\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5904\u7406\u65b9\u7a0b\u4e0d\u5408\u6cd5\u6216\u8f93\u5165\u9519\u8bef\u7684\u60c5\u51b5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"C\u8bed\u8a00\u4ece\u952e\u76d8\u4e0a\u8f93\u5165\u76f4\u7ebf\u65b9\u7a0b\uff0c\u6c42\u4ea4\u70b9\u5750\u6807\u9700\u91c7\u53d6\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u5148\u89e3\u6790\u65b9\u7a0b\u5f0f\u3001\u7136\u540e\u8bbe\u7f6e\u65b9\u7a0b\u53c2\u6570\u3001\u7d27\u63a5\u7740\u5229\u7528\u6570\u5b66\u516c\u5f0f\u8ba1\u7b97\u4ea4 [&hellip;]","protected":false},"author":3,"featured_media":307160,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/307138"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=307138"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/307138\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/307160"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=307138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=307138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=307138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}