{"id":85497,"date":"2026-07-27T16:49:49","date_gmt":"2026-07-27T08:49:49","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/85497.html"},"modified":"2026-07-27T16:49:49","modified_gmt":"2026-07-27T08:49:49","slug":"c-%e8%af%ad%e8%a8%80%e5%88%86%e6%94%af%e4%b8%8e%e5%be%aa%e7%8e%af%e8%af%ad%e5%8f%a5%e5%ae%8c%e5%85%a8%e6%8c%87%e5%8d%97%ef%bc%9a%e4%bb%8e%e5%85%a5%e9%97%a8%e5%88%b0%e5%ae%9e%e6%88%98","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/85497.html","title":{"rendered":"C \u8bed\u8a00\u5206\u652f\u4e0e\u5faa\u73af\u8bed\u53e5\u5b8c\u5168\u6307\u5357\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218"},"content":{"rendered":"<p>\u5b66 C \u8bed\u8a00\u7684\u65f6\u5019&#xff0c;\u6700\u8ba9\u4eba\u5934\u79c3\u7684\u5f80\u5f80\u4e0d\u662f\u6307\u9488\u548c\u5185\u5b58\u2014\u2014\u800c\u662f\u7a0b\u5e8f\u5230\u5e95\u5728\u6309\u4ec0\u4e48\u987a\u5e8f\u6267\u884c\u3002\u4e00\u884c\u4e00\u884c\u5f80\u4e0b\u8d70&#xff1f;\u8fd8\u662f\u8df3\u6765\u8df3\u53bb&#xff1f;\u8fd8\u662f\u53cd\u590d\u8f6c\u5708&#xff1f;<\/p>\n<p>\u7b54\u6848\u662f&#xff1a;\u5168\u9760\u63a7\u5236\u6d41\u8bed\u53e5\u3002C \u8bed\u8a00\u7684\u6267\u884c\u987a\u5e8f\u7531\u4e24\u5927\u7c7b\u8bed\u53e5\u51b3\u5b9a&#xff1a;<\/p>\n<p>1. \u5206\u652f\u8bed\u53e5&#xff08;Branch&#xff09;&#xff1a;\u6839\u636e\u6761\u4ef6\u9009\u62e9\u8d70\u54ea\u6761\u8def\u2014\u2014if\u3001else\u3001switch<\/p>\n<p>2. \u5faa\u73af\u8bed\u53e5&#xff08;Loop&#xff09;&#xff1a;\u8ba9\u4ee3\u7801\u53cd\u590d\u6267\u884c\u2014\u2014while\u3001do-while\u3001for<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u628a\u8fd9\u4e24\u7c7b\u8bed\u53e5\u8bb2\u900f&#xff1a;\u8bed\u6cd5\u7ed3\u6784\u662f\u4ec0\u4e48\u3001\u6267\u884c\u6d41\u7a0b\u957f\u4ec0\u4e48\u6837\u3001\u4ec0\u4e48\u65f6\u5019\u7528\u54ea\u4e2a\u3001\u6709\u54ea\u4e9b\u5751\u8981\u907f\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u6574\u4f53\u6982\u89c8&#xff1a;C \u8bed\u8a00\u63a7\u5236\u6d41\u5bb6\u65cf<\/h3>\n<p>\u5148\u770b\u4e00\u5f20\u603b\u56fe&#xff0c;\u5efa\u7acb\u5168\u5c40\u5370\u8c61&#xff1a;<\/p>\n<p>flowchart TD<br \/>\n    A[\u63a7\u5236\u6d41\u8bed\u53e5] &#8211;&gt; B[\u5206\u652f\u8bed\u53e5]<br \/>\n    A &#8211;&gt; C[\u5faa\u73af\u8bed\u53e5]<br \/>\n    B &#8211;&gt; B1[if \/ else if \/ else]<br \/>\n    B &#8211;&gt; B2[switch \/ case]<br \/>\n    C &#8211;&gt; C1[while]<br \/>\n    C &#8211;&gt; C2[do-while]<br \/>\n    C &#8211;&gt; C3[for]<\/p>\n<p class=\"img-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727084946-6a671baac1874.png\" \/><\/p>\n<p style=\"text-align:center\">\u56fe 1&#xff1a;C \u8bed\u8a00\u63a7\u5236\u6d41\u8bed\u53e5\u603b\u89c8\u2014\u2014\u5de6\u4fa7\u4e3a\u5206\u652f\u8bed\u53e5\u65cf&#xff0c;\u53f3\u4fa7\u4e3a\u5faa\u73af\u8bed\u53e5\u65cf<\/p>\n<p>\u4ece\u56fe\u4e2d\u53ef\u4ee5\u770b\u5230&#xff0c;\u5206\u652f\u8bed\u53e5\u8d1f\u8d23&#034;\u505a\u9009\u62e9&#034;&#xff0c;\u5faa\u73af\u8bed\u53e5\u8d1f\u8d23&#034;\u91cd\u590d\u505a&#034;\u3002\u4e24\u8005\u7ecf\u5e38\u914d\u5408\u4f7f\u7528&#xff08;\u6bd4\u5982\u5728\u5faa\u73af\u91cc\u7528 if \u5224\u65ad\u662f\u5426\u8df3\u51fa&#xff09;&#xff0c;\u662f\u7f16\u5199\u4efb\u4f55\u6709\u903b\u8f91\u7684\u7a0b\u5e8f\u7684\u57fa\u7840\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u5206\u652f\u8bed\u53e5&#xff1a;\u8ba9\u7a0b\u5e8f\u5b66\u4f1a\u505a\u5224\u65ad<\/h3>\n<h4>2.1 if \/ else if \/ else \u2014\u2014 \u6700\u5e38\u7528\u7684\u6761\u4ef6\u5206\u652f<\/h4>\n<p>if \u662f C \u8bed\u8a00\u4e2d\u6700\u57fa\u672c\u7684\u5206\u652f\u8bed\u53e5\u3002\u5b83\u7684\u903b\u8f91\u5f88\u7b80\u5355&#xff1a;\u5982\u679c\u6761\u4ef6\u6210\u7acb&#xff0c;\u5c31\u6267\u884c\u67d0\u6bb5\u4ee3\u7801&#xff1b;\u5426\u5219&#xff0c;\u6267\u884c\u53e6\u4e00\u6bb5&#xff08;\u6216\u4ec0\u4e48\u90fd\u4e0d\u505a&#xff09;\u3002<\/p>\n<p>\u57fa\u672c\u8bed\u6cd5&#xff1a;<\/p>\n<p>if (\u6761\u4ef6\u8868\u8fbe\u5f0f) {<br \/>\n    \/* \u6761\u4ef6\u4e3a\u771f\u65f6\u6267\u884c\u7684\u4ee3\u7801 *\/<br \/>\n} else if (\u53e6\u4e00\u4e2a\u6761\u4ef6) {<br \/>\n    \/* \u4e0a\u4e00\u4e2a\u6761\u4ef6\u4e3a\u5047\u3001\u8fd9\u4e2a\u6761\u4ef6\u4e3a\u771f\u65f6\u6267\u884c *\/<br \/>\n} else {<br \/>\n    \/* \u6240\u6709\u6761\u4ef6\u90fd\u4e3a\u5047\u65f6\u6267\u884c *\/<br \/>\n}<\/p>\n<p>\u5173\u952e\u89c4\u5219&#xff1a;<\/p>\n<ul>\n<li>\u6761\u4ef6\u8868\u8fbe\u5f0f\u5fc5\u987b\u662f\u6807\u91cf\u7c7b\u578b&#xff08;\u6574\u6570\u3001\u5b57\u7b26\u3001\u6307\u9488&#xff09;&#xff0c;\u7ed3\u679c\u4e3a 0 \u8868\u793a\u5047&#xff0c;\u975e 0 \u8868\u793a\u771f<\/li>\n<li>\u82b1\u62ec\u53f7 {}&#xff1a;\u5982\u679c\u53ea\u6709\u4e00\u6761\u8bed\u53e5\u53ef\u4ee5\u7701\u7565&#xff0c;\u4f46\u5f3a\u70c8\u5efa\u8bae\u6c38\u8fdc\u4e0d\u7701&#xff08;\u907f\u514d\u60ac\u6302 else \u7b49 bug&#xff09;<\/li>\n<li>else \u603b\u662f\u4e0e\u6700\u8fd1\u7684\u672a\u5339\u914d\u7684 if \u914d\u5bf9\u2014\u2014\u8fd9\u662f\u7ecf\u5178\u9762\u8bd5\u9898<\/li>\n<\/ul>\n<p>\u6267\u884c\u6d41\u7a0b\u5982\u4e0b&#xff1a;<\/p>\n<p>flowchart TD<br \/>\n    S[\u5f00\u59cb] &#8211;&gt; C1{\u6761\u4ef61}<br \/>\n    C1 &#8211;&gt;|\u771f| A1[\u6267\u884c\u4ee3\u7801\u57571]<br \/>\n    C1 &#8211;&gt;|\u5047| C2{\u6761\u4ef62}<br \/>\n    C2 &#8211;&gt;|\u771f| A2[\u6267\u884c\u4ee3\u7801\u57572]<br \/>\n    C2 &#8211;&gt;|\u5047| C3{\u6761\u4ef63}<br \/>\n    C3 &#8211;&gt;|\u771f| A3[\u6267\u884c\u4ee3\u7801\u57573]<br \/>\n    C3 &#8211;&gt;|\u5047| E[\u6267\u884celse\u4ee3\u7801\u5757]<br \/>\n    A1 &#8211;&gt; End[\u7ed3\u675f]<br \/>\n    A2 &#8211;&gt; End<br \/>\n    A3 &#8211;&gt; End<br \/>\n    E &#8211;&gt; End<\/p>\n<p class=\"img-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727084947-6a671bab1af83.png\" \/><\/p>\n<p style=\"text-align:center\">\u56fe 2&#xff1a;if-else-if \u9636\u68af\u5f0f\u6761\u4ef6\u5224\u65ad\u7684\u5b8c\u6574\u6267\u884c\u6d41\u7a0b\u3002\u7a0b\u5e8f\u4ece\u4e0a\u5230\u4e0b\u4f9d\u6b21\u68c0\u67e5\u6bcf\u4e2a\u6761\u4ef6&#xff0c;\u9047\u5230\u7b2c\u4e00\u4e2a\u4e3a\u771f\u7684\u5c31\u8fdb\u5165\u5bf9\u5e94\u5206\u652f&#xff0c;\u4e4b\u540e\u7684\u6240\u6709 else-if \u548c else \u90fd\u88ab\u8df3\u8fc7<\/p>\n<p>\u4e00\u4e2a\u5b9e\u9645\u4f8b\u5b50\u2014\u2014\u6210\u7ee9\u7b49\u7ea7\u5224\u5b9a&#xff1a;<\/p>\n<p>int score &#061; 85;<\/p>\n<p>if (score &gt;&#061; 90) {<br \/>\n    printf(&#034;\u4f18\u79c0\\\\n&#034;);<br \/>\n} else if (score &gt;&#061; 80) {<br \/>\n    printf(&#034;\u826f\u597d\\\\n&#034;);   \/* score&#061;85 \u8d70\u8fd9\u91cc *\/<br \/>\n} else if (score &gt;&#061; 60) {<br \/>\n    printf(&#034;\u53ca\u683c\\\\n&#034;);<br \/>\n} else {<br \/>\n    printf(&#034;\u4e0d\u53ca\u683c\\\\n&#034;);<br \/>\n}<\/p>\n<h4>2.2 switch-case \u2014\u2014 \u591a\u8def\u5206\u652f\u7684\u5229\u5668<\/h4>\n<p>\u5f53\u4f60\u9700\u8981\u6839\u636e\u4e00\u4e2a\u53d8\u91cf\u7684\u503c\u4ece\u5f88\u591a\u9009\u9879\u4e2d\u9009\u4e00\u4e2a\u65f6&#xff0c;\u5199\u4e00\u957f\u4e32 if-else if \u65e2\u96be\u770b\u53c8\u4f4e\u6548\u3002\u8fd9\u65f6\u5c31\u8be5 switch \u51fa\u573a\u4e86\u3002<\/p>\n<p>switch (\u6574\u578b\u8868\u8fbe\u5f0f) {<br \/>\n    case \u5e38\u91cf1:<br \/>\n        \u8bed\u53e5\u7ec41;<br \/>\n        break;    \/* \u522b\u5fd8\u4e86&#xff01;*\/<br \/>\n    case \u5e38\u91cf2:<br \/>\n        \u8bed\u53e5\u7ec42;<br \/>\n        break;<br \/>\n    \/* &#8230; \u66f4\u591a case &#8230; *\/<br \/>\n    default:<br \/>\n        \u9ed8\u8ba4\u8bed\u53e5\u7ec4;   \/* \u6240\u6709 case \u90fd\u4e0d\u5339\u914d\u65f6\u6267\u884c *\/<br \/>\n}<\/p>\n<p>\u6838\u5fc3\u8981\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u8868\u8fbe\u5f0f\u5fc5\u987b\u662f\u6574\u6570\u7c7b\u578b&#xff08;int\u3001char\u3001\u679a\u4e3e&#xff09;&#xff0c;\u4e0d\u80fd\u7528\u6d6e\u70b9\u6570\u6216\u5b57\u7b26\u4e32<\/li>\n<li>case \u540e\u9762\u7684\u503c\u5fc5\u987b\u662f\u7f16\u8bd1\u671f\u5e38\u91cf&#xff0c;\u4e0d\u80fd\u662f\u53d8\u91cf<\/li>\n<li>break \u7684\u4f5c\u7528\u662f\u8df3\u51fa switch\u2014\u2014\u6f0f\u5199\u4f1a\u5bfc\u81f4&#034;\u7a7f\u900f&#034;&#xff08;fall-through&#xff09;&#xff0c;\u7ee7\u7eed\u6267\u884c\u4e0b\u4e00\u4e2a case \u7684\u4ee3\u7801<\/li>\n<\/ul>\n<p>flowchart TD<br \/>\n    S[\u8ba1\u7b97\u8868\u8fbe\u5f0f] &#8211;&gt; C1{\u5339\u914dcase1?}<br \/>\n    C1 &#8211;&gt;|\u662f| A1[\u6267\u884c\u8bed\u53e5\u7ec41] &#8211;&gt; B1{\u6709break?}<br \/>\n    B1 &#8211;&gt;|\u6709| End[\u7ed3\u675f]<br \/>\n    B1 &#8211;&gt;|\u65e0| A2[\u6267\u884c\u8bed\u53e5\u7ec42]<br \/>\n    C1 &#8211;&gt;|\u5426| C2{\u5339\u914dcase2?}<br \/>\n    C2 &#8211;&gt;|\u662f| A2 &#8211;&gt; B2{\u6709break?}<br \/>\n    B2 &#8211;&gt;|\u6709| End<br \/>\n    B2 &#8211;&gt;|\u65e0| A3[\u7ee7\u7eed\u7a7f\u900f&#8230;]<br \/>\n    C2 &#8211;&gt;|\u5426| More{\u5339\u914d\u66f4\u591acase&#8230;}<br \/>\n    More &#8211;&gt;|\u4e0d\u5339\u914d| Default[\u6267\u884cdefault] &#8211;&gt; End<\/p>\n<p class=\"img-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727084947-6a671bab56045.png\" \/><\/p>\n<p style=\"text-align:center\">\u56fe 3&#xff1a;switch-case \u591a\u5206\u652f\u9009\u62e9\u8bed\u53e5\u7684\u6267\u884c\u6d41\u7a0b\u3002\u8ba1\u7b97\u8868\u8fbe\u5f0f\u7684\u503c\u540e&#xff0c;\u8df3\u8f6c\u5230\u5339\u914d\u7684 case \u6807\u7b7e&#xff1b;break \u8d1f\u8d23\u8df3\u51fa&#xff0c;\u7f3a\u5c11 break \u4f1a\u7a7f\u900f\u5230\u4e0b\u4e00\u4e2a case<\/p>\n<p>\u7a7f\u900f&#xff08;fall-through&#xff09;\u6709\u65f6\u662f\u6709\u610f\u4e3a\u4e4b\u7684\u6280\u5de7&#xff1a;<\/p>\n<p>int day &#061; 5;<br \/>\nswitch (day) {<br \/>\n    case 1: case 2: case 3: case 4: case 5:<br \/>\n        printf(&#034;\u5de5\u4f5c\u65e5\\\\n&#034;);<br \/>\n        break;<br \/>\n    case 6: case 7:<br \/>\n        printf(&#034;\u5468\u672b\\\\n&#034;);<br \/>\n        break;<br \/>\n}<\/p>\n<p>\u4f46\u66f4\u591a\u65f6\u5019\u5b83\u662f bug \u7684\u6765\u6e90\u3002\u5efa\u8bae&#xff1a;\u6bcf\u4e2a case \u90fd\u5199 break&#xff0c;\u9664\u975e\u4f60\u660e\u786e\u9700\u8981\u7a7f\u900f\u884c\u4e3a\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001\u5faa\u73af\u8bed\u53e5&#xff1a;\u8ba9\u4ee3\u7801\u91cd\u590d\u5e72\u6d3b<\/h3>\n<h4>3.1 while \u5faa\u73af \u2014\u2014 \u5148\u5224\u65ad&#xff0c;\u540e\u6267\u884c<\/h4>\n<p>while \u662f\u6700\u7b80\u5355\u7684\u5faa\u73af&#xff1a;\u53ea\u8981\u6761\u4ef6\u4e3a\u771f&#xff0c;\u5c31\u53cd\u590d\u6267\u884c\u5faa\u73af\u4f53\u3002<\/p>\n<p>while (\u6761\u4ef6\u8868\u8fbe\u5f0f) {<br \/>\n    \/* \u5faa\u73af\u4f53&#xff1a;\u6761\u4ef6\u4e3a\u771f\u65f6\u91cd\u590d\u6267\u884c *\/<br \/>\n}<\/p>\n<p>flowchart TD<br \/>\n    S[\u5f00\u59cb] &#8211;&gt; C{\u6761\u4ef6\u4e3a\u771f?}<br \/>\n    C &#8211;&gt;|\u662f| B[\u6267\u884c\u5faa\u73af\u4f53] &#8211;&gt; C<br \/>\n    C &#8211;&gt;|\u5426| E[\u7ed3\u675f]<\/p>\n<p class=\"img-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727084947-6a671bab8d7ac.png\" \/><\/p>\n<p style=\"text-align:center\">\u56fe 4&#xff1a;while \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b\u3002\u6bcf\u6b21\u8fed\u4ee3\u90fd\u5148\u68c0\u67e5\u6761\u4ef6&#xff0c;\u6761\u4ef6\u4e3a\u771f\u624d\u8fdb\u5165\u5faa\u73af\u4f53&#xff0c;\u6761\u4ef6\u4e3a\u5047\u7acb\u5373\u9000\u51fa<\/p>\n<p>\u6ce8\u610f\u5b83\u7684\u7279\u70b9&#xff1a;\u6761\u4ef6\u4e00\u5f00\u59cb\u5c31\u662f\u5047\u7684 \u2192 \u5faa\u73af\u4f53\u4e00\u6b21\u90fd\u4e0d\u6267\u884c\u3002\u8fd9\u548c do-while \u5f62\u6210\u9c9c\u660e\u5bf9\u6bd4\u3002<\/p>\n<p>\u5178\u578b\u7528\u6cd5\u2014\u2014\u8ba1\u6570\u5faa\u73af&#xff1a;<\/p>\n<p>int i &#061; 0;<br \/>\nwhile (i &lt; 5) {<br \/>\n    printf(&#034;i &#061; %d\\\\n&#034;, i);<br \/>\n    i&#043;&#043;;   \/* \u522b\u5fd8\u4e86\u66f4\u65b0\u5faa\u73af\u53d8\u91cf&#xff01;\u5426\u5219\u6b7b\u5faa\u73af *\/<br \/>\n}<br \/>\n\/* \u8f93\u51fa&#xff1a;i &#061; 0, 1, 2, 3, 4 *\/<\/p>\n<h4>3.2 do-while \u5faa\u73af \u2014\u2014 \u5148\u6267\u884c&#xff0c;\u540e\u5224\u65ad<\/h4>\n<p>do-while \u548c while \u51e0\u4e4e\u4e00\u6837&#xff0c;\u53ea\u6709\u4e00\u4e2a\u5173\u952e\u533a\u522b&#xff1a;\u5b83\u81f3\u5c11\u6267\u884c\u4e00\u6b21\u5faa\u73af\u4f53&#xff0c;\u7136\u540e\u518d\u53bb\u5224\u65ad\u6761\u4ef6\u3002<\/p>\n<p>do {<br \/>\n    \/* \u5faa\u73af\u4f53&#xff1a;\u81f3\u5c11\u6267\u884c\u4e00\u6b21 *\/<br \/>\n} while (\u6761\u4ef6\u8868\u8fbe\u5f0f);   \/* \u6ce8\u610f\u672b\u5c3e\u7684\u5206\u53f7&#xff01;*\/<\/p>\n<p>flowchart TD<br \/>\n    subgraph while\u5faa\u73af<br \/>\n        W1[\u5f00\u59cb] &#8211;&gt; W2{\u6761\u4ef6?}<br \/>\n        W2 &#8211;&gt;|\u771f| W3[\u6267\u884c\u5faa\u73af\u4f53] &#8211;&gt; W2<br \/>\n        W2 &#8211;&gt;|\u5047| W4[\u7ed3\u675f]<br \/>\n    end<br \/>\n    subgraph do-while\u5faa\u73af<br \/>\n        D1[\u5f00\u59cb] &#8211;&gt; D2[\u6267\u884c\u5faa\u73af\u4f53]<br \/>\n        D2 &#8211;&gt; D3{\u6761\u4ef6?}<br \/>\n        D3 &#8211;&gt;|\u771f| D2<br \/>\n        D3 &#8211;&gt;|\u5047| D4[\u7ed3\u675f]<br \/>\n    end<\/p>\n<p class=\"img-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727084947-6a671baba112f.png\" \/><\/p>\n<p style=\"text-align:center\">\u56fe 5&#xff1a;do-while \u4e0e while \u7684\u5bf9\u6bd4\u3002\u5de6&#xff1a;while \u5148\u5224\u65ad\u518d\u6267\u884c&#xff08;\u53ef\u80fd 0 \u6b21&#xff09;&#xff1b;\u53f3&#xff1a;do-while \u5148\u6267\u884c\u518d\u5224\u65ad&#xff08;\u81f3\u5c11 1 \u6b21&#xff09;\u3002\u8fd9\u662f\u4e24\u8005\u552f\u4e00\u4f46\u672c\u8d28\u7684\u533a\u522b<\/p>\n<p>\u4ec0\u4e48\u65f6\u5019\u7528 do-while&#xff1f;<\/p>\n<ul>\n<li>\u83dc\u5355\u5faa\u73af&#xff1a;\u5148\u663e\u793a\u83dc\u5355&#xff0c;\u518d\u95ee\u7528\u6237\u8981\u4e0d\u8981\u7ee7\u7eed<\/li>\n<li>\u8f93\u5165\u6821\u9a8c&#xff1a;\u5148\u8bfb\u53d6\u8f93\u5165&#xff0c;\u518d\u5224\u65ad\u662f\u5426\u5408\u6cd5&#xff0c;\u4e0d\u5408\u6cd5\u5c31\u91cd\u65b0\u8f93\u5165<\/li>\n<\/ul>\n<p>int choice;<br \/>\ndo {<br \/>\n    printf(&#034;&#061;&#061;&#061;&#061;&#061; \u4e3b\u83dc\u5355 &#061;&#061;&#061;&#061;&#061;\\\\n&#034;);<br \/>\n    printf(&#034;1. \u65b0\u5efa\u6587\u4ef6\\\\n&#034;);<br \/>\n    printf(&#034;2. \u6253\u5f00\u6587\u4ef6\\\\n&#034;);<br \/>\n    printf(&#034;3. \u9000\u51fa\\\\n&#034;);<br \/>\n    printf(&#034;\u8bf7\u9009\u62e9&#xff1a;&#034;);<br \/>\n    scanf(&#034;%d&#034;, &amp;choice);<br \/>\n} while (choice &lt; 1 || choice &gt; 3);   \/* \u8f93\u5165\u4e0d\u5408\u6cd5\u5c31\u91cd\u65b0\u663e\u793a\u83dc\u5355 *\/<\/p>\n<h4>3.3 for \u5faa\u73af \u2014\u2014 \u6700\u5f3a\u5927\u7684\u5faa\u73af<\/h4>\n<p>for \u5faa\u73af\u628a&#034;\u521d\u59cb\u5316\u3001\u6761\u4ef6\u5224\u65ad\u3001\u66f4\u65b0&#034;\u4e09\u4ef6\u4e8b\u5199\u5728\u540c\u4e00\u884c&#xff0c;\u662f C \u8bed\u8a00\u4e2d\u4f7f\u7528\u9891\u7387\u6700\u9ad8\u7684\u5faa\u73af\u3002<\/p>\n<p>for (\u521d\u59cb\u5316\u8868\u8fbe\u5f0f; \u6761\u4ef6\u8868\u8fbe\u5f0f; \u66f4\u65b0\u8868\u8fbe\u5f0f) {<br \/>\n    \/* \u5faa\u73af\u4f53 *\/<br \/>\n}<\/p>\n<p>flowchart TD<br \/>\n    Init[\u521d\u59cb\u5316\u8868\u8fbe\u5f0f] &#8211;&gt; Cond{\u6761\u4ef6\u8868\u8fbe\u5f0f}<br \/>\n    Cond &#8211;&gt;|\u771f| Body[\u6267\u884c\u5faa\u73af\u4f53]<br \/>\n    Body &#8211;&gt; Update[\u66f4\u65b0\u8868\u8fbe\u5f0f]<br \/>\n    Update &#8211;&gt; Cond<br \/>\n    Cond &#8211;&gt;|\u5047| End[\u7ed3\u675f]<\/p>\n<p class=\"img-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727084947-6a671babbb26e.png\" \/><\/p>\n<p style=\"text-align:center\">\u56fe 6&#xff1a;for \u5faa\u73af\u7684\u56db\u90e8\u5206\u7ed3\u6784\u89e3\u5256\u3002\u2460\u521d\u59cb\u5316\u53ea\u6267\u884c\u4e00\u6b21 \u2192 \u2461\u5224\u65ad\u6761\u4ef6 \u2192 \u2462\u6267\u884c\u5faa\u73af\u4f53 \u2192 \u2463\u6267\u884c\u66f4\u65b0\u8868\u8fbe\u5f0f \u2192 \u56de\u5230\u2461\u3002\u4e09\u4e2a\u8868\u8fbe\u5f0f\u90fd\u53ef\u4ee5\u7701\u7565&#xff08;\u5206\u53f7\u4e0d\u80fd\u7701&#xff09;<\/p>\n<p>\u7b49\u4ef7\u7684 while \u5199\u6cd5&#xff1a;<\/p>\n<p>\/* for \u7248\u672c *\/<br \/>\nfor (int i &#061; 0; i &lt; 10; i&#043;&#043;) {<br \/>\n    printf(&#034;%d &#034;, i);<br \/>\n}<\/p>\n<p>\/* \u7b49\u4ef7 while \u7248\u672c *\/<br \/>\nint i &#061; 0;           \/* \u5bf9\u5e94\u521d\u59cb\u5316 *\/<br \/>\nwhile (i &lt; 10) {     \/* \u5bf9\u5e94\u6761\u4ef6 *\/<br \/>\n    printf(&#034;%d &#034;, i);<br \/>\n    i&#043;&#043;;             \/* \u5bf9\u5e94\u66f4\u65b0 *\/<br \/>\n}<\/p>\n<p>for \u7684\u7075\u6d3b\u4e4b\u5904\u5728\u4e8e\u4e09\u4e2a\u8868\u8fbe\u5f0f\u90fd\u53ef\u4ee5\u7701\u7565&#xff1a;<\/p>\n<ul>\n<li>\u7701\u7565\u5168\u90e8\u4e09\u4e2a \u2192 for(;;) &#061; \u65e0\u9650\u5faa\u73af&#xff08;\u9700\u8981 break \u9000\u51fa&#xff09;<\/li>\n<li>\u7701\u7565\u6761\u4ef6 &#061; \u6761\u4ef6\u6c38\u8fdc\u4e3a\u771f &#061; \u65e0\u9650\u5faa\u73af<\/li>\n<li>\u7701\u7565\u521d\u59cb\u5316 &#061; \u53d8\u91cf\u5728\u5916\u90e8\u5df2\u7ecf\u5b9a\u4e49\u597d<\/li>\n<\/ul>\n<p>\u5e38\u89c1\u6a21\u5f0f\u901f\u67e5&#xff1a;<\/p>\n<table>\n<tr>\u6a21\u5f0f\u5199\u6cd5\u7528\u9014<\/tr>\n<tbody>\n<tr>\n<td>\u8ba1\u6570\u5faa\u73af<\/td>\n<td>for(i&#061;0; i&lt;n; i&#043;&#043;)<\/td>\n<td>\u904d\u5386\u56fa\u5b9a\u6b21\u6570<\/td>\n<\/tr>\n<tr>\n<td>\u5012\u5e8f\u5faa\u73af<\/td>\n<td>for(i&#061;n-1; i&gt;&#061;0; i&#8211;)<\/td>\n<td>\u53cd\u5411\u904d\u5386<\/td>\n<\/tr>\n<tr>\n<td>\u6b65\u8fdb\u5faa\u73af<\/td>\n<td>for(i&#061;0; i&lt;n; i&#043;&#061;2)<\/td>\n<td>\u6bcf\u6b21\u6b65\u8fdb 2<\/td>\n<\/tr>\n<tr>\n<td>\u65e0\u9650\u5faa\u73af<\/td>\n<td>for(;;)<\/td>\n<td>\u4e8b\u4ef6\u76d1\u542c\/\u670d\u52a1\u5668<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u56db\u3001\u63a7\u5236\u8bed\u53e5&#xff1a;break \u4e0e continue<\/h3>\n<p>\u5728\u5faa\u73af\u5185\u90e8&#xff0c;\u6211\u4eec\u5e38\u5e38\u9700\u8981\u6539\u53d8\u6b63\u5e38\u7684\u6267\u884c\u6d41\u7a0b\u3002\u4e24\u4e2a\u5173\u952e\u5b57\u627f\u62c5\u4e86\u8fd9\u4e2a\u804c\u8d23&#xff1a;<\/p>\n<h4>4.1 break \u2014\u2014 \u7acb\u5373\u8df3\u51fa<\/h4>\n<p>break \u7684\u4f5c\u7528\u662f\u7acb\u5373\u7ec8\u6b62\u5f53\u524d\u6240\u5728\u7684\u5faa\u73af\u6216 switch&#xff0c;\u8df3\u5230\u540e\u9762\u7684\u4ee3\u7801\u7ee7\u7eed\u6267\u884c\u3002<\/p>\n<p>flowchart TD<br \/>\n    subgraph break<br \/>\n        B1[\u5faa\u73af\u6267\u884c\u4e2d] &#8211;&gt; B2{break?}<br \/>\n        B2 &#8211;&gt;|\u662f| B3[\u8df3\u51fa\u5faa\u73af]<br \/>\n        B2 &#8211;&gt;|\u5426| B4[\u7ee7\u7eed\u6267\u884c]<br \/>\n    end<br \/>\n    subgraph continue<br \/>\n        C1[\u5faa\u73af\u6267\u884c\u4e2d] &#8211;&gt; C2{continue?}<br \/>\n        C2 &#8211;&gt;|\u662f| C3[\u8df3\u8fc7\u672c\u6b21\u5269\u4f59\u4ee3\u7801]<br \/>\n        C3 &#8211;&gt; C4[\u56de\u5230\u6761\u4ef6\u5224\u65ad]<br \/>\n        C2 &#8211;&gt;|\u5426| C5[\u7ee7\u7eed\u6267\u884c]<br \/>\n    end<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727084947-6a671babcec5e.png\" \/><\/p>\n<p style=\"text-align:center\">\u56fe 7&#xff1a;break \u4e0e continue \u5728\u5faa\u73af\u4e2d\u7684\u884c\u4e3a\u5bf9\u6bd4\u3002\u5de6&#xff1a;break \u76f4\u63a5\u8df3\u51fa\u6574\u4e2a\u5faa\u73af&#xff0c;\u540e\u7eed\u4ee3\u7801\u4e0d\u518d\u6267\u884c&#xff1b;\u53f3&#xff1a;continue \u53ea\u8df3\u8fc7\u672c\u6b21\u8fed\u4ee3\u7684\u5269\u4f59\u90e8\u5206&#xff0c;\u56de\u5230\u6761\u4ef6\u5224\u65ad\u51c6\u5907\u4e0b\u4e00\u8f6e<\/p>\n<p>\/* \u627e\u5230\u7b2c\u4e00\u4e2a\u80fd\u88ab 7 \u6574\u9664\u7684\u6570\u5c31\u505c\u6b62 *\/<br \/>\nfor (int i &#061; 1; i &lt;&#061; 100; i&#043;&#043;) {<br \/>\n    if (i % 7 &#061;&#061; 0) {<br \/>\n        printf(&#034;\u627e\u5230&#xff1a;%d\\\\n&#034;, i);  \/* \u8f93\u51fa 7 *\/<br \/>\n        break;              \/* \u7acb\u523b\u9000\u51fa\u5faa\u73af *\/<br \/>\n    }<br \/>\n}<br \/>\n\/* \u5faa\u73af\u7ed3\u675f\u540e\u4ece\u8fd9\u91cc\u7ee7\u7eed *\/<\/p>\n<h4>4.2 continue \u2014\u2014 \u8df3\u8fc7\u672c\u8f6e<\/h4>\n<p>continue \u4e0d\u9000\u51fa\u5faa\u73af&#xff0c;\u5b83\u53ea\u662f\u8df3\u8fc7\u672c\u6b21\u8fed\u4ee3\u4e2d\u5269\u4e0b\u7684\u4ee3\u7801&#xff0c;\u76f4\u63a5\u56de\u5230\u5faa\u73af\u7684\u6761\u4ef6\u5224\u65ad\u5904&#xff0c;\u51c6\u5907\u4e0b\u4e00\u8f6e\u3002<\/p>\n<p>\/* \u6253\u5370 1~10 \u4e2d\u6240\u6709\u5947\u6570 *\/<br \/>\nfor (int i &#061; 1; i &lt;&#061; 10; i&#043;&#043;) {<br \/>\n    if (i % 2 &#061;&#061; 0) {<br \/>\n        continue;   \/* \u5076\u6570\u8df3\u8fc7&#xff0c;\u4e0d\u6253\u5370 *\/<br \/>\n    }<br \/>\n    printf(&#034;%d &#034;, i);  \/* \u53ea\u6709\u5947\u6570\u80fd\u5230\u8fd9\u91cc *\/<br \/>\n}<br \/>\n\/* \u8f93\u51fa&#xff1a;1 3 5 7 9 *\/<\/p>\n<p>\u8bb0\u5fc6\u53e3\u8bc0&#xff1a;break \u662f&#034;\u6211\u4e0d\u5e72\u4e86&#034;&#xff0c;continue \u662f&#034;\u8fd9\u6b21\u4e0d\u7b97&#xff0c;\u4e0b\u6b21\u518d\u6765&#034;\u3002<\/p>\n<hr \/>\n<h3>\u4e94\u3001\u5d4c\u5957\u5faa\u73af&#xff1a;\u5916\u5c42\u8d70\u4e00\u6b65&#xff0c;\u5185\u5c42\u8dd1\u4e00\u5708<\/h3>\n<p>\u5f53\u4e00\u4e2a\u5faa\u73af\u7684\u5faa\u73af\u4f53\u91cc\u53c8\u5305\u542b\u53e6\u4e00\u4e2a\u5faa\u73af\u65f6&#xff0c;\u5c31\u53eb\u5d4c\u5957\u5faa\u73af&#xff08;nested loop&#xff09;\u3002\u8fd9\u662f\u6253\u5370\u4e5d\u4e5d\u4e58\u6cd5\u8868\u3001\u77e9\u9635\u8fd0\u7b97\u3001\u56fe\u6848\u8f93\u51fa\u7b49\u573a\u666f\u7684\u6838\u5fc3\u6280\u672f\u3002<\/p>\n<p>flowchart TD<br \/>\n    Outer[\u5916\u5c42\u5faa\u73af\u5f00\u59cb] &#8211;&gt; OuterCond{\u5916\u5c42\u6761\u4ef6}<br \/>\n    OuterCond &#8211;&gt;|\u771f| Inner[\u5185\u5c42\u5faa\u73af\u5f00\u59cb]<br \/>\n    Inner &#8211;&gt; InnerCond{\u5185\u5c42\u6761\u4ef6}<br \/>\n    InnerCond &#8211;&gt;|\u771f| InnerBody[\u6267\u884c\u5185\u5c42\u5faa\u73af\u4f53]<br \/>\n    InnerBody &#8211;&gt; InnerUpdate[\u5185\u5c42\u66f4\u65b0] &#8211;&gt; InnerCond<br \/>\n    InnerCond &#8211;&gt;|\u5047| OuterUpdate[\u5916\u5c42\u66f4\u65b0] &#8211;&gt; OuterCond<br \/>\n    OuterCond &#8211;&gt;|\u5047| End[\u7ed3\u675f]<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727084947-6a671babedbe4.png\" \/><\/p>\n<p style=\"text-align:center\">\u56fe 8&#xff1a;\u5d4c\u5957\u5faa\u73af\u7684\u6267\u884c\u987a\u5e8f\u3002\u5916\u5c42\u6bcf\u63a8\u8fdb\u4e00\u8f6e&#xff0c;\u5185\u5c42\u90fd\u8981\u4ece\u5934\u5230\u5c3e\u5b8c\u6574\u6267\u884c\u4e00\u904d\u3002\u603b\u6267\u884c\u6b21\u6570 &#061; \u5916\u5c42\u8fed\u4ee3\u6b21\u6570 \u00d7 \u5185\u5c42\u8fed\u4ee3\u6b21\u6570<\/p>\n<p>\u7ecf\u5178\u6848\u4f8b\u2014\u2014\u4e5d\u4e5d\u4e58\u6cd5\u8868&#xff1a;<\/p>\n<p>for (int i &#061; 1; i &lt;&#061; 9; i&#043;&#043;) {         \/* \u5916\u5c42&#xff1a;\u884c 1~9 *\/<br \/>\n    for (int j &#061; 1; j &lt;&#061; i; j&#043;&#043;) {     \/* \u5185\u5c42&#xff1a;\u5217 1~i *\/<br \/>\n        printf(&#034;%dx%d&#061;%-4d&#034;, j, i, i * j);<br \/>\n    }<br \/>\n    printf(&#034;\\\\n&#034;);                       \/* \u6bcf\u884c\u7ed3\u675f\u540e\u6362\u884c *\/<br \/>\n}<\/p>\n<p>\u8f93\u51fa&#xff1a;<\/p>\n<p>1&#215;1&#061;1<br \/>\n1&#215;2&#061;2   2&#215;2&#061;4<br \/>\n1&#215;3&#061;3   2&#215;3&#061;6   3&#215;3&#061;9<br \/>\n&#8230;&#xff08;\u5171 9 \u884c&#xff0c;\u7b2c n \u884c\u6709 n \u4e2a\u5f0f\u5b50&#xff09;<\/p>\n<p>\u5d4c\u5957\u5faa\u73af\u7684\u6027\u80fd\u6ce8\u610f\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u53cc\u5c42\u5d4c\u5957\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u901a\u5e38\u662f O(n\u00b2)&#xff0c;\u6570\u636e\u91cf\u5927\u65f6\u8981\u8b66\u60d5<\/li>\n<li>\u80fd\u7528\u5355\u5c42\u5faa\u73af\u89e3\u51b3\u7684\u95ee\u9898\u4e0d\u8981\u7528\u5d4c\u5957&#xff08;\u6bd4\u5982\u628a\u4e8c\u7ef4\u6570\u7ec4\u5c55\u5e73\u6210\u4e00\u7ef4&#xff09;<\/li>\n<li>break \u53ea\u8df3\u51fa\u6700\u8fd1\u7684\u4e00\u5c42\u5faa\u73af&#xff0c;\u4e0d\u4f1a\u540c\u65f6\u8df3\u51fa\u6240\u6709\u5c42<\/li>\n<\/ul>\n<hr \/>\n<h3>\u516d\u3001\u5b9e\u6218\u7ec3\u4e60&#xff1a;\u7efc\u5408\u8fd0\u7528<\/h3>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7ed3\u5408\u4e86\u5206\u652f\u3001\u5faa\u73af\u548c\u63a7\u5236\u8bed\u53e5\u7684\u5b8c\u6574\u793a\u4f8b\u2014\u2014\u731c\u6570\u5b57\u6e38\u620f&#xff1a;<\/p>\n<p>#include &lt;stdio.h&gt;<br \/>\n#include &lt;stdlib.h&gt;<br \/>\n#include &lt;time.h&gt;<\/p>\n<p>int main() {<br \/>\n    srand((unsigned int)time(NULL));<br \/>\n    int secret &#061; rand() % 100 &#043; 1;   \/* 1~100 \u7684\u968f\u673a\u6570 *\/<br \/>\n    int guess, count &#061; 0;<\/p>\n<p>    printf(&#034;&#061;&#061;&#061; \u731c\u6570\u5b57\u6e38\u620f &#061;&#061;&#061;\\\\n&#034;);<br \/>\n    printf(&#034;\u6211\u60f3\u4e86\u4e00\u4e2a 1~100 \u4e4b\u95f4\u7684\u6570\u5b57&#xff0c;\u4f60\u6765\u731c&#xff01;\\\\n\\\\n&#034;);<\/p>\n<p>    do {<br \/>\n        printf(&#034;\u8bf7\u8f93\u5165\u4f60\u7684\u731c\u6d4b&#xff08;1~100&#xff09;&#xff1a;&#034;);<br \/>\n        scanf(&#034;%d&#034;, &amp;guess);<br \/>\n        count&#043;&#043;;<\/p>\n<p>        if (guess &lt; 1 || guess &gt; 100) {<br \/>\n            printf(&#034;\u8303\u56f4\u4e0d\u5bf9&#xff01;\u8bf7\u8f93\u5165 1~100 \u4e4b\u95f4\u7684\u6570\u3002\\\\n\\\\n&#034;);<br \/>\n            continue;   \/* \u8df3\u8fc7&#xff0c;\u91cd\u65b0\u8f93\u5165 *\/<br \/>\n        }<\/p>\n<p>        if (guess &gt; secret) {<br \/>\n            printf(&#034;\u592a\u5927\u4e86&#xff01;\u518d\u8bd5\u8bd5\u3002\\\\n\\\\n&#034;);<br \/>\n        } else if (guess &lt; secret) {<br \/>\n            printf(&#034;\u592a\u5c0f\u4e86&#xff01;\u518d\u8bd5\u8bd5\u3002\\\\n\\\\n&#034;);<br \/>\n        } else {<br \/>\n            printf(&#034;\\\\n\u606d\u559c\u4f60\u731c\u5bf9\u4e86&#xff01;\u7b54\u6848\u5c31\u662f %d\\\\n&#034;, secret);<br \/>\n            printf(&#034;\u4f60\u4e00\u5171\u731c\u4e86 %d \u6b21\u3002\\\\n&#034;, count);<br \/>\n            break;     \/* \u731c\u5bf9\u4e86&#xff0c;\u9000\u51fa\u5faa\u73af *\/<br \/>\n        }<\/p>\n<p>        if (count &gt;&#061; 10) {<br \/>\n            printf(&#034;\u4f60\u5df2\u7ecf\u731c\u4e86 10 \u6b21&#xff0c;\u6e38\u620f\u7ed3\u675f\u3002\\\\n&#034;);<br \/>\n            printf(&#034;\u6b63\u786e\u7b54\u6848\u662f %d\\\\n&#034;, secret);<br \/>\n            break;<br \/>\n        }<br \/>\n    } while (1);   \/* \u65e0\u9650\u5faa\u73af&#xff0c;\u9760 break \u9000\u51fa *\/<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<p>\u8fd9\u4e2a\u5c0f\u7a0b\u5e8f\u7528\u5230\u4e86\u672c\u6587\u8bb2\u5230\u7684\u6240\u6709\u77e5\u8bc6\u70b9&#xff1a;<\/p>\n<ul>\n<li>do-while&#xff1a;\u4fdd\u8bc1\u81f3\u5c11\u8fd0\u884c\u4e00\u6b21<\/li>\n<li>if \/ else if \/ else&#xff1a;\u591a\u8def\u5206\u652f\u5224\u65ad\u5927\u5c0f\u5173\u7cfb<\/li>\n<li>continue&#xff1a;\u8df3\u8fc7\u975e\u6cd5\u8f93\u5165<\/li>\n<li>break&#xff1a;\u4e24\u79cd\u9000\u51fa\u65b9\u5f0f&#xff08;\u731c\u5bf9 \/ \u8d85\u8fc7\u6b21\u6570&#xff09;<\/li>\n<li>rand() &#043; %&#xff1a;\u751f\u6210\u968f\u673a\u6570<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e03\u3001\u603b\u7ed3\u4e0e\u6ce8\u610f\u4e8b\u9879<\/h3>\n<table>\n<tr>\u8bed\u53e5\u7c7b\u578b\u6838\u5fc3\u7279\u70b9\u5178\u578b\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>if \/ else<\/td>\n<td>\u5206\u652f<\/td>\n<td>\u5148\u5224\u65ad\u540e\u6267\u884c&#xff0c;\u53ef\u5d4c\u5957<\/td>\n<td>\u6761\u4ef6\u5224\u65ad\u3001\u8303\u56f4\u68c0\u67e5<\/td>\n<\/tr>\n<tr>\n<td>switch \/ case<\/td>\n<td>\u5206\u652f<\/td>\n<td>\u6574\u6570\u503c\u591a\u8def\u8df3\u8f6c<\/td>\n<td>\u83dc\u5355\u9009\u62e9\u3001\u72b6\u6001\u673a<\/td>\n<\/tr>\n<tr>\n<td>while<\/td>\n<td>\u5faa\u73af<\/td>\n<td>\u5148\u5224\u65ad\u540e\u6267\u884c&#xff0c;\u53ef\u80fd 0 \u6b21<\/td>\n<td>\u4e0d\u786e\u5b9a\u6b21\u6570\u7684\u5faa\u73af<\/td>\n<\/tr>\n<tr>\n<td>do-while<\/td>\n<td>\u5faa\u73af<\/td>\n<td>\u5148\u6267\u884c\u540e\u5224\u65ad&#xff0c;\u81f3\u5c11 1 \u6b21<\/td>\n<td>\u83dc\u5355\u5faa\u73af\u3001\u8f93\u5165\u6821\u9a8c<\/td>\n<\/tr>\n<tr>\n<td>for<\/td>\n<td>\u5faa\u73af<\/td>\n<td>\u4e09\u5408\u4e00&#xff08;\u521d\u59cb\/\u6761\u4ef6\/\u66f4\u65b0&#xff09;<\/td>\n<td>\u56fa\u5b9a\u6b21\u6570\u904d\u5386<\/td>\n<\/tr>\n<tr>\n<td>break<\/td>\n<td>\u63a7\u5236<\/td>\n<td>\u8df3\u51fa\u6574\u4e2a\u5faa\u73af\/switch<\/td>\n<td>\u627e\u5230\u76ee\u6807\u540e\u9000\u51fa<\/td>\n<\/tr>\n<tr>\n<td>continue<\/td>\n<td>\u63a7\u5236<\/td>\n<td>\u8df3\u8fc7\u672c\u6b21\u5269\u4f59\u4ee3\u7801<\/td>\n<td>\u8fc7\u6ee4\u4e0d\u9700\u8981\u7684\u6570\u636e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u65b0\u624b\u6700\u5bb9\u6613\u72af\u7684\u9519&#xff1a;<\/p>\n<li>if (x &#061; 5) \u2014\u2014 \u8d4b\u503c\u53f7\u5199\u6210\u6bd4\u8f83\u53f7&#xff08;\u5e94\u8be5 &#061;&#061;&#xff09;&#xff0c;\u6c38\u8fdc\u4e3a\u771f<\/li>\n<li>switch \u91cc\u5fd8\u8bb0\u5199 break \u2014\u2014 \u5bfc\u81f4\u610f\u5916\u7684\u7a7f\u900f<\/li>\n<li>do-while \u5fd8\u8bb0\u672b\u5c3e\u5206\u53f7 \u2014\u2014 \u7f16\u8bd1\u9519\u8bef<\/li>\n<li>\u5faa\u73af\u4f53\u5185\u5fd8\u8bb0\u66f4\u65b0\u5faa\u73af\u53d8\u91cf \u2014\u2014 \u6b7b\u5faa\u73af<\/li>\n<li>for \u5faa\u73af\u7684\u4e09\u4e2a\u8868\u8fbe\u5f0f\u4e4b\u95f4\u7528\u9017\u53f7\u800c\u4e0d\u662f\u5206\u53f7 \u2014\u2014 \u8bed\u6cd5\u9519\u8bef<\/li>\n<hr \/>\n<p>\u638c\u63e1\u4e86\u5206\u652f\u548c\u5faa\u73af&#xff0c;\u4f60\u5c31\u638c\u63e1\u4e86 C \u8bed\u8a00\u7a0b\u5e8f\u7684&#034;\u9aa8\u67b6&#034;\u3002\u63a5\u4e0b\u6765\u53ef\u4ee5\u6311\u6218\u66f4\u590d\u6742\u7684\u7ec4\u5408\u5e94\u7528&#xff1a;\u7528\u5d4c\u5957\u5faa\u73af\u6253\u5370\u5404\u79cd\u56fe\u6848\u3001\u7528 switch \u5b9e\u73b0\u7b80\u5355\u8ba1\u7b97\u5668\u3001\u7528 break &#043; \u6807\u7b7e\u5b9e\u73b0\u591a\u5c42\u8df3\u51fa\u3002\u591a\u5199\u4ee3\u7801\u3001\u591a\u753b\u6d41\u7a0b\u56fe&#xff0c;\u8fd9\u4e9b\u6982\u5ff5\u5f88\u5feb\u5c31\u4f1a\u53d8\u6210\u4f60\u7684\u808c\u8089\u8bb0\u5fc6\u3002<\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>\u5b66 C \u8bed\u8a00\u7684\u65f6\u5019&#xff0c;\u6700\u8ba9\u4eba\u5934\u79c3\u7684\u5f80\u5f80\u4e0d\u662f\u6307\u9488\u548c\u5185\u5b58\u2014\u2014\u800c\u662f\u7a0b\u5e8f\u5230\u5e95\u5728\u6309\u4ec0\u4e48\u987a\u5e8f\u6267\u884c\u3002\u4e00\u884c\u4e00\u884c\u5f80\u4e0b\u8d70&#xff1f;\u8fd8\u662f\u8df3\u6765\u8df3\u53bb&#xff1f;\u8fd8\u662f\u53cd\u590d\u8f6c\u5708&#xff1f;\u7b54\u6848\u662f&#xff1a;\u5168\u9760\u63a7\u5236\u6d41\u8bed\u53e5\u3002C \u8bed\u8a00\u7684\u6267\u884c\u987a\u5e8f\u7531\u4e24\u5927\u7c7b\u8bed\u53e5\u51b3\u5b9a&#xff1a;1. \u5206\u652f\u8bed\u53e5&#xff08;Branch&#xff09;&#xff1a;\u6839\u636e\u6761\u4ef6\u9009\u62e9\u8d70\u54ea\u6761\u8def\u2014\u2014if\u3001else\u3001switch2. \u5faa\u73af\u8bed\u53e5&#xff08;Loop&#xff09;&#xff1a;\u8ba9\u4ee3\u7801\u53cd\u590d\u6267<\/p>\n","protected":false},"author":2,"featured_media":85489,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9099,9609,174,99,87,176],"topic":[],"class_list":["post-85497","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-9099","tag-9609","tag-c","tag-java","tag-87","tag-176"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C \u8bed\u8a00\u5206\u652f\u4e0e\u5faa\u73af\u8bed\u53e5\u5b8c\u5168\u6307\u5357\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218 - \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\/85497.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C \u8bed\u8a00\u5206\u652f\u4e0e\u5faa\u73af\u8bed\u53e5\u5b8c\u5168\u6307\u5357\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5b66 C \u8bed\u8a00\u7684\u65f6\u5019&#xff0c;\u6700\u8ba9\u4eba\u5934\u79c3\u7684\u5f80\u5f80\u4e0d\u662f\u6307\u9488\u548c\u5185\u5b58\u2014\u2014\u800c\u662f\u7a0b\u5e8f\u5230\u5e95\u5728\u6309\u4ec0\u4e48\u987a\u5e8f\u6267\u884c\u3002\u4e00\u884c\u4e00\u884c\u5f80\u4e0b\u8d70&#xff1f;\u8fd8\u662f\u8df3\u6765\u8df3\u53bb&#xff1f;\u8fd8\u662f\u53cd\u590d\u8f6c\u5708&#xff1f;\u7b54\u6848\u662f&#xff1a;\u5168\u9760\u63a7\u5236\u6d41\u8bed\u53e5\u3002C \u8bed\u8a00\u7684\u6267\u884c\u987a\u5e8f\u7531\u4e24\u5927\u7c7b\u8bed\u53e5\u51b3\u5b9a&#xff1a;1. \u5206\u652f\u8bed\u53e5&#xff08;Branch&#xff09;&#xff1a;\u6839\u636e\u6761\u4ef6\u9009\u62e9\u8d70\u54ea\u6761\u8def\u2014\u2014if\u3001else\u3001switch2. \u5faa\u73af\u8bed\u53e5&#xff08;Loop&#xff09;&#xff1a;\u8ba9\u4ee3\u7801\u53cd\u590d\u6267\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/85497.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-27T08:49:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727084946-6a671baac1874.png\" \/>\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=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/85497.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/85497.html\",\"name\":\"C \u8bed\u8a00\u5206\u652f\u4e0e\u5faa\u73af\u8bed\u53e5\u5b8c\u5168\u6307\u5357\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-27T08:49:49+00:00\",\"dateModified\":\"2026-07-27T08:49:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/85497.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/85497.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/85497.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C \u8bed\u8a00\u5206\u652f\u4e0e\u5faa\u73af\u8bed\u53e5\u5b8c\u5168\u6307\u5357\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218\"}]},{\"@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 \u8bed\u8a00\u5206\u652f\u4e0e\u5faa\u73af\u8bed\u53e5\u5b8c\u5168\u6307\u5357\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218 - \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\/85497.html","og_locale":"zh_CN","og_type":"article","og_title":"C \u8bed\u8a00\u5206\u652f\u4e0e\u5faa\u73af\u8bed\u53e5\u5b8c\u5168\u6307\u5357\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5b66 C \u8bed\u8a00\u7684\u65f6\u5019&#xff0c;\u6700\u8ba9\u4eba\u5934\u79c3\u7684\u5f80\u5f80\u4e0d\u662f\u6307\u9488\u548c\u5185\u5b58\u2014\u2014\u800c\u662f\u7a0b\u5e8f\u5230\u5e95\u5728\u6309\u4ec0\u4e48\u987a\u5e8f\u6267\u884c\u3002\u4e00\u884c\u4e00\u884c\u5f80\u4e0b\u8d70&#xff1f;\u8fd8\u662f\u8df3\u6765\u8df3\u53bb&#xff1f;\u8fd8\u662f\u53cd\u590d\u8f6c\u5708&#xff1f;\u7b54\u6848\u662f&#xff1a;\u5168\u9760\u63a7\u5236\u6d41\u8bed\u53e5\u3002C \u8bed\u8a00\u7684\u6267\u884c\u987a\u5e8f\u7531\u4e24\u5927\u7c7b\u8bed\u53e5\u51b3\u5b9a&#xff1a;1. \u5206\u652f\u8bed\u53e5&#xff08;Branch&#xff09;&#xff1a;\u6839\u636e\u6761\u4ef6\u9009\u62e9\u8d70\u54ea\u6761\u8def\u2014\u2014if\u3001else\u3001switch2. \u5faa\u73af\u8bed\u53e5&#xff08;Loop&#xff09;&#xff1a;\u8ba9\u4ee3\u7801\u53cd\u590d\u6267","og_url":"https:\/\/www.wsisp.com\/helps\/85497.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-27T08:49:49+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727084946-6a671baac1874.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/85497.html","url":"https:\/\/www.wsisp.com\/helps\/85497.html","name":"C \u8bed\u8a00\u5206\u652f\u4e0e\u5faa\u73af\u8bed\u53e5\u5b8c\u5168\u6307\u5357\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-27T08:49:49+00:00","dateModified":"2026-07-27T08:49:49+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/85497.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/85497.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/85497.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"C \u8bed\u8a00\u5206\u652f\u4e0e\u5faa\u73af\u8bed\u53e5\u5b8c\u5168\u6307\u5357\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u6218"}]},{"@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\/85497","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=85497"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/85497\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/85489"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=85497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=85497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=85497"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=85497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}