{"id":65950,"date":"2026-01-25T23:32:34","date_gmt":"2026-01-25T15:32:34","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/65950.html"},"modified":"2026-01-25T23:32:34","modified_gmt":"2026-01-25T15:32:34","slug":"c%e5%ad%a6%e4%b9%a0%e8%b7%af%e7%ba%bf%e5%85%b6%e4%b8%80%ef%bc%9a%e5%85%a5%e9%97%a8%e7%af%87%ef%bc%9a6-%e5%be%aa%e7%8e%af%e8%af%ad%e5%8f%a5","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/65950.html","title":{"rendered":"C++\u5b66\u4e60\u8def\u7ebf\u5176\u4e00\uff1a\u5165\u95e8\u7bc7\uff1a6.\u5faa\u73af\u8bed\u53e5"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"%E5%BE%AA%E7%8E%AF%E8%AF%AD%E5%8F%A5-toc\" style=\"margin-left:0px\">\u5faa\u73af\u8bed\u53e5<\/p>\n<p id=\"for%E5%BE%AA%E7%8E%AF-toc\" style=\"margin-left:0px\">for\u5faa\u73af<\/p>\n<p id=\"%E4%B8%BE%E4%BE%8B%E8%AF%B4%E6%98%8E-toc\" style=\"margin-left:40px\">\u4e3e\u4f8b\u8bf4\u660e<\/p>\n<p id=\"for%20%E5%BE%AA%E7%8E%AF%E7%9A%84%E6%89%A7%E8%A1%8C%E6%B5%81%E7%A8%8B-toc\" style=\"margin-left:40px\">for \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b<\/p>\n<p id=\"%E7%BB%83%E4%B9%A0%EF%BC%9A%EF%BC%88%E8%87%AA%E5%B7%B1%E5%8A%A8%E6%89%8B%E5%86%99%E4%B8%80%E4%B8%8B%EF%BC%89-toc\" style=\"margin-left:40px\">\u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09;<\/p>\n<p id=\"while%E5%BE%AA%E7%8E%AF-toc\" style=\"margin-left:0px\">while\u5faa\u73af<\/p>\n<p id=\"%E4%B8%BE%E4%BE%8B%E8%AF%B4%E6%98%8E-toc\" style=\"margin-left:40px\">\u4e3e\u4f8b\u8bf4\u660e<\/p>\n<p id=\"while%20%E5%BE%AA%E7%8E%AF%E7%9A%84%E6%89%A7%E8%A1%8C%E6%B5%81%E7%A8%8B-toc\" style=\"margin-left:40px\">while \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b<\/p>\n<p id=\"%E7%BB%83%E4%B9%A0%EF%BC%9A%EF%BC%88%E8%87%AA%E5%B7%B1%E5%8A%A8%E6%89%8B%E5%86%99%E4%B8%80%E4%B8%8B%EF%BC%89-toc\" style=\"margin-left:40px\">\u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09;<\/p>\n<p id=\"do-while%20%E5%BE%AA%E7%8E%AF%EF%BC%88%E8%87%B3%E5%B0%91%E6%89%A7%E8%A1%8C%E4%B8%80%E6%AC%A1%EF%BC%89-toc\" style=\"margin-left:0px\">do-while \u5faa\u73af&#xff08;\u81f3\u5c11\u6267\u884c\u4e00\u6b21&#xff09;<\/p>\n<p id=\"%E4%B8%BE%E4%BE%8B%E8%AF%B4%E6%98%8E-toc\" style=\"margin-left:40px\">\u4e3e\u4f8b\u8bf4\u660e<\/p>\n<p id=\"do-while%20%E5%BE%AA%E7%8E%AF%E7%9A%84%E6%89%A7%E8%A1%8C%E6%B5%81%E7%A8%8B-toc\" style=\"margin-left:40px\">do-while \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b<\/p>\n<p id=\"%E7%BB%83%E4%B9%A0%EF%BC%9A%EF%BC%88%E8%87%AA%E5%B7%B1%E5%8A%A8%E6%89%8B%E5%86%99%E4%B8%80%E4%B8%8B%EF%BC%89-toc\" style=\"margin-left:40px\">\u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09;<\/p>\n<p id=\"break%E5%92%8Ccontinue%E8%AF%AD%E5%8F%A5-toc\" style=\"margin-left:0px\">break\u548ccontinue\u8bed\u53e5<\/p>\n<p id=\"break%EF%BC%9A%E7%9B%B4%E6%8E%A5%E9%80%80%E5%87%BA%E6%95%B4%E4%B8%AA%E5%BE%AA%E7%8E%AF%EF%BC%88%E7%BB%88%E6%AD%A2%E5%BE%AA%E7%8E%AF%EF%BC%89-toc\" style=\"margin-left:40px\">break&#xff1a;\u76f4\u63a5\u9000\u51fa\u6574\u4e2a\u5faa\u73af&#xff08;\u7ec8\u6b62\u5faa\u73af&#xff09;<\/p>\n<p id=\"continue%EF%BC%9A%E8%B7%B3%E8%BF%87%E6%9C%AC%E6%AC%A1%E5%BE%AA%E7%8E%AF%EF%BC%8C%E7%BB%A7%E7%BB%AD%E4%B8%8B%E4%B8%80%E6%AC%A1-toc\" style=\"margin-left:40px\">continue&#xff1a;\u8df3\u8fc7\u672c\u6b21\u5faa\u73af&#xff0c;\u7ee7\u7eed\u4e0b\u4e00\u6b21<\/p>\n<p id=\"%E5%BE%AA%E7%8E%AF%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9-toc\" style=\"margin-left:0px\">\u5faa\u73af\u6ce8\u610f\u4e8b\u9879<\/p>\n<p id=\"%E5%BE%AA%E7%8E%AF%E7%9A%84%E4%BD%BF%E7%94%A8%E5%BB%BA%E8%AE%AE-toc\" style=\"margin-left:0px\">\u5faa\u73af\u7684\u4f7f\u7528\u5efa\u8bae<\/p>\n<p id=\"%E7%BB%8F%E5%85%B8%E7%BB%83%E4%B9%A0%E9%A2%98-toc\" style=\"margin-left:0px\">\u7ecf\u5178\u7ec3\u4e60\u9898<\/p>\n<p id=\"%E7%BB%93%E5%B0%BE-toc\" style=\"margin-left:0px\">\u7ed3\u5c3e<\/p>\n<hr id=\"hr-toc\" \/>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u540c\u5fd7\u4eec&#xff0c;\u6211\u53c8\u6765\u8fa3&#xff01;\u4eca\u5929\u7ed9\u5927\u5bb6\u5206\u4eab\u7684\u662f\u5faa\u73af\u8bed\u53e5\u3002\u5e9f\u8bdd\u4e0d\u591a\u8bf4&#xff0c;\u76f4\u63a5\u5f00\u6574&#xff01;<\/p>\n<h2 id=\"%E5%BE%AA%E7%8E%AF%E8%AF%AD%E5%8F%A5\">\u5faa\u73af\u8bed\u53e5<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5728\u7f16\u7a0b\u4e2d&#xff0c;\u6211\u4eec\u7ecf\u5e38\u9700\u8981\u91cd\u590d\u505a\u540c\u4e00\u4ef6\u4e8b&#xff1a;\u6bd4\u5982\u8ba1\u7b97 1 \u5230 100 \u7684\u548c\u3001\u6253\u5370 10 \u904d \u201cHello World\u201d\u3001\u8ba9\u7a0b\u5e8f\u4e00\u76f4\u8fd0\u884c\u76f4\u5230\u7528\u6237\u8f93\u5165 \u201c\u9000\u51fa\u201d\u3002\u5982\u679c\u7528\u987a\u5e8f\u7ed3\u6784\u7684\u4ee3\u7801&#xff0c;\u9700\u8981\u5199 10 \u904dcout\u3001\u5199 100 \u6b21\u52a0\u6cd5&#xff0c;\u4ee3\u7801\u53c8\u957f\u53c8\u7b28&#xff0c;\u8fd8\u5bb9\u6613\u51fa\u9519\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u800c\u5faa\u73af\u8bed\u53e5\u5c31\u662f\u4e3a\u4e86\u89e3\u51b3\u300c\u91cd\u590d\u6267\u884c\u67d0\u6bb5\u4ee3\u7801\u300d\u7684\u95ee\u9898 \u2014\u2014 \u5b83\u80fd\u8ba9\u4e00\u6bb5\u4ee3\u7801\u6309\u7167\u8bbe\u5b9a\u7684\u89c4\u5219&#xff0c;\u81ea\u52a8\u91cd\u590d\u6267\u884c N \u6b21&#xff0c;\u76f4\u5230\u6ee1\u8db3\u505c\u6b62\u6761\u4ef6\u4e3a\u6b62\u3002\u8fd9\u662f C&#043;&#043; \u4e09\u5927\u7a0b\u5e8f\u7ed3\u6784&#xff08;\u987a\u5e8f\u3001\u9009\u62e9\u3001\u5faa\u73af&#xff09;\u7684\u6700\u540e\u4e00\u5757\u6838\u5fc3\u62fc\u56fe\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0C&#043;&#043; \u4e2d\u6709\u4e09\u79cd\u6838\u5fc3\u5faa\u73af\u8bed\u53e5&#xff1a;for\u3001while\u3001do-while<\/p>\n<p>\u5faa\u73af\u7684 3 \u4e2a\u6838\u5fc3\u8981\u7d20&#xff1a;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6240\u6709\u5faa\u73af\u90fd\u79bb\u4e0d\u5f00\u8fd9 3 \u4e2a\u8981\u7d20&#xff0c;\u5c11\u4e00\u4e2a\u8981\u4e48\u5faa\u73af\u4e0d\u6267\u884c&#xff0c;\u8981\u4e48\u53d8\u6210\u300c\u6b7b\u5faa\u73af\u300d&#xff08;\u6c38\u8fdc\u505c\u4e0d\u4e0b\u6765&#xff09;&#xff1a;<\/p>\n<li>\u521d\u59cb\u5316&#xff1a;\u7ed9\u5faa\u73af\u7684 \u201c\u8ba1\u6570\u5668\u201d \u8d4b\u521d\u59cb\u503c&#xff08;\u6bd4\u5982\u8dd1\u6b65\u524d\u5148\u8bb0 \u201c\u5df2\u8dd1 0 \u5708\u201d&#xff09;&#xff1b;<\/li>\n<li>\u5faa\u73af\u6761\u4ef6&#xff1a;\u5224\u65ad\u662f\u5426\u7ee7\u7eed\u5faa\u73af\u7684\u89c4\u5219&#xff08;\u6bd4\u5982 \u201c\u5df2\u8dd1\u5708\u6570 &lt; 5\u201d&#xff09;&#xff1b;<\/li>\n<li>\u66f4\u65b0 \/ \u8fed\u4ee3&#xff1a;\u6bcf\u6b21\u5faa\u73af\u540e\u66f4\u65b0\u8ba1\u6570\u5668&#xff08;\u6bd4\u5982\u8dd1\u5b8c 1 \u5708&#xff0c;\u628a \u201c\u5df2\u8dd1\u5708\u6570\u201d \u52a0 1&#xff09;\u3002<\/li>\n<h2 id=\"for%E5%BE%AA%E7%8E%AF\">for\u5faa\u73af<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for \u5faa\u73af\u662f\u4f60\u63d0\u524d\u544a\u8bc9\u7a0b\u5e8f \u201c\u8981\u5faa\u73af\u591a\u5c11\u6b21\u201d&#xff0c;\u7a0b\u5e8f\u5c31\u6309\u6b21\u6570\u91cd\u590d\u6267\u884c&#xff0c;\u6b21\u6570\u5230\u4e86\u5c31\u505c\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6bd4\u5982&#xff1a;\u201c\u6253\u5370 5 \u904d Hello World\u201d\u201c\u8ba1\u7b97 1 \u5230 100 \u7684\u548c\u201d&#xff0c;\u7528 for \u5faa\u73af\u6700\u65b9\u4fbf&#xff0c;\u4ee3\u7801\u7ed3\u6784\u4e00\u773c\u5c31\u80fd\u770b\u51fa\u5faa\u73af\u6b21\u6570\u3002<\/p>\n<p>for (\u521d\u59cb\u5316\u8868\u8fbe\u5f0f; \u5faa\u73af\u6761\u4ef6\u8868\u8fbe\u5f0f; \u66f4\u65b0\u8868\u8fbe\u5f0f)<br \/>\n{<br \/>\n    \/\/ \u5faa\u73af\u4f53&#xff1a;\u8981\u91cd\u590d\u6267\u884c\u7684\u4ee3\u7801<br \/>\n    \u91cd\u590d\u6267\u884c\u7684\u4ee3\u7801;<br \/>\n} <\/p>\n<p>for\u5faa\u73af&#xff1a;\u4e09\u4e2a\u8981\u7d20\u96c6\u4e2d\u5199&#xff0c;\u7ed3\u6784\u6e05\u6670&#xff0c;\u9002\u7528\u4e8e\u77e5\u9053\u300c\u5faa\u73af\u6b21\u6570\u300d\u7684\u573a\u666f&#xff08;\u6bd4\u5982\u5faa\u73af 10 \u6b21\u30011 \u5230 100&#xff09;\u3002<\/p>\n<\/p>\n<h3 id=\"%E4%B8%BE%E4%BE%8B%E8%AF%B4%E6%98%8E\" style=\"background-color:transparent\">\u4e3e\u4f8b\u8bf4\u660e<\/h3>\n<p>\/\/ \u521d\u59cb\u5316&#xff1a;\u5df2\u8dd10\u5708 \u2192 \u6761\u4ef6&#xff1a;\u5df2\u8dd1\u5708\u6570 &lt; 5 \u2192 \u66f4\u65b0&#xff1a;\u6bcf\u8dd11\u5708\u52a01<br \/>\nfor (int circle &#061; 0; circle &lt; 5; circle&#043;&#043;)<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u6b63\u5728\u8dd1\u7b2c&#034; &lt;&lt; circle&#043;1 &lt;&lt; &#034;\u5708&#034; &lt;&lt; endl; \/\/ \u5faa\u73af\u4f53&#xff1a;\u8dd11\u5708\u7684\u64cd\u4f5c<br \/>\n} <\/p>\n<ul>\n<li>\u521d\u59cb\u5316&#xff1a;int circle &#061; 0 \u2192 \u5b9a\u4e49\u8ba1\u6570\u5668\u53d8\u91cf&#xff0c;\u8d4b\u521d\u59cb\u503c&#xff08;\u8d4b\u503c\u64cd\u4f5c\u53ea\u6267\u884c 1 \u6b21&#xff0c;\u5728\u5faa\u73af\u5f00\u59cb\u524d\u6267\u884c&#xff09;&#xff1b;<\/li>\n<li>\u5faa\u73af\u6761\u4ef6&#xff1a;circle &lt; 5 \u2192 \u6bcf\u6b21\u5faa\u73af\u524d\u5224\u65ad&#xff0c;\u7ed3\u679c\u4e3a\u771f&#xff08;\u975e 0&#xff09;\u5c31\u6267\u884c\u5faa\u73af\u4f53&#xff0c;\u4e3a\u5047&#xff08;0&#xff09;\u5c31\u9000\u51fa&#xff1b;<\/li>\n<li>\u66f4\u65b0\u8868\u8fbe\u5f0f&#xff1a;circle&#043;&#043; \u2192 \u6bcf\u6b21\u5faa\u73af\u4f53\u6267\u884c\u5b8c\u540e\u6267\u884c&#xff0c;\u66f4\u65b0\u8ba1\u6570\u5668&#xff1b;<\/li>\n<li>\u5faa\u73af\u4f53&#xff1a;\u5927\u62ec\u53f7\u91cc\u7684\u4ee3\u7801 \u2192 \u6761\u4ef6\u4e3a\u771f\u65f6\u91cd\u590d\u6267\u884c\u7684\u5185\u5bb9<\/li>\n<\/ul>\n<p>\u6ce8&#xff1a;\u5faa\u73af\u4f53\u7684\u4ee3\u7801\u5982\u679c\u53ea\u6709\u5355\u884c\u53ef\u7701\u7565\u5927\u62ec\u53f7&#xff0c;\u4f46\u8fd8\u662f\u5efa\u8bae\u52a0\u4e0a\u5927\u62ec\u53f7&#xff0c;\u66f4\u6e05\u6670<\/p>\n<p>for (int circle &#061; 0; circle &lt; 5; circle&#043;&#043;)<br \/>\n    cout &lt;&lt; &#034;\u6b63\u5728\u8dd1\u7b2c&#034; &lt;&lt; circle&#043;1 &lt;&lt; &#034;\u5708&#034; &lt;&lt; endl; \/\/ \u5faa\u73af\u4f53&#xff1a;\u8dd11\u5708\u7684\u64cd\u4f5c <\/p>\n<h3 id=\"for%20%E5%BE%AA%E7%8E%AF%E7%9A%84%E6%89%A7%E8%A1%8C%E6%B5%81%E7%A8%8B\" style=\"background-color:transparent\">for \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b<\/h3>\n<p>\u4ee5 \u201c\u8dd1 5 \u5708\u201d \u4e3a\u4f8b&#xff1a;<\/p>\n<li>\u6267\u884c\u521d\u59cb\u5316&#xff1a;circle &#061; 0&#xff08;\u53ea\u505a 1 \u6b21&#xff09;&#xff1b;<\/li>\n<li>\u5224\u65ad\u6761\u4ef6&#xff1a;0 &lt; 5 \u2192 \u771f \u2192 \u6267\u884c\u5faa\u73af\u4f53&#xff08;\u6253\u5370 \u201c\u6b63\u5728\u8dd1\u7b2c 1 \u5708\u201d&#xff09;&#xff1b;<\/li>\n<li>\u6267\u884c\u66f4\u65b0&#xff1a;circle&#043;&#043; \u2192 circle \u53d8\u6210 1&#xff1b;<\/li>\n<li>\u5224\u65ad\u6761\u4ef6&#xff1a;1 &lt; 5 \u2192 \u771f \u2192 \u6267\u884c\u5faa\u73af\u4f53&#xff08;\u6253\u5370 \u201c\u6b63\u5728\u8dd1\u7b2c 2 \u5708\u201d&#xff09;&#xff1b;<\/li>\n<li>\u6267\u884c\u66f4\u65b0&#xff1a;circle&#043;&#043; \u2192 circle \u53d8\u6210 2&#xff1b;<\/li>\n<li>\u2026\u2026 \u91cd\u590d\u6b65\u9aa4 2-4&#xff0c;\u76f4\u5230 circle&#061;5&#xff1b;<\/li>\n<li>\u5224\u65ad\u6761\u4ef6&#xff1a;5 &lt; 5 \u2192 \u5047 \u2192 \u9000\u51fa\u5faa\u73af\u3002<\/li>\n<h3 id=\"%E7%BB%83%E4%B9%A0%EF%BC%9A%EF%BC%88%E8%87%AA%E5%B7%B1%E5%8A%A8%E6%89%8B%E5%86%99%E4%B8%80%E4%B8%8B%EF%BC%89\" style=\"background-color:transparent\">\u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09;<\/h3>\n<p>1&#xff1a;\u6253\u5370 10 \u904d \u201cHello World\u201d<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<br \/>\nint main() {<br \/>\n    \/\/ i\u4ece0\u52309&#xff0c;\u517110\u6b21\u5faa\u73af<br \/>\n    for (int i &#061; 0; i &lt; 10; i&#043;&#043;)<br \/>\n    {<br \/>\n        cout &lt;&lt; &#034;Hello World&#xff01;\u7b2c&#034; &lt;&lt; i&#043;1 &lt;&lt; &#034;\u904d&#034; &lt;&lt; endl;<br \/>\n    }<br \/>\n    return 0;<br \/>\n} <\/p>\n<p>2&#xff1a;\u8ba1\u7b97 1 \u5230 100 \u7684\u548c<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<br \/>\nint main() {<br \/>\n    int sum &#061; 0; \/\/ \u5b58\u50a8\u603b\u548c&#xff0c;\u521d\u59cb\u503c0<br \/>\n    \/\/ i\u4ece1\u5230100&#xff0c;\u6bcf\u6b21\u52a01<br \/>\n    for (int i &#061; 1; i &lt;&#061; 100; i&#043;&#043;)<br \/>\n    {<br \/>\n        sum &#061; sum &#043; i; \/\/ \u6bcf\u6b21\u5faa\u73af\u628ai\u52a0\u5230sum\u91cc<br \/>\n    }<br \/>\n    cout &lt;&lt; &#034;1\u5230100\u7684\u548c\u662f&#xff1a;&#034; &lt;&lt; sum &lt;&lt; endl; \/\/ \u7ed3\u679c&#xff1a;5050<br \/>\n    return 0;<br \/>\n} <\/p>\n<p>3&#xff1a;\u6253\u5370 10 \u4ee5\u5185\u7684\u5076\u6570<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<br \/>\nint main() {<br \/>\n    cout &lt;&lt; &#034;10\u4ee5\u5185\u7684\u5076\u6570&#xff1a;&#034; &lt;&lt; endl;<br \/>\n    for (int i &#061; 1; i &lt;&#061; 10; i&#043;&#043;)<br \/>\n    {<br \/>\n        if (i % 2 &#061;&#061; 0) \/\/ \u5224\u65ad\u662f\u5426\u4e3a\u5076\u6570<br \/>\n        {<br \/>\n            cout &lt;&lt; i &lt;&lt; &#034; &#034;;<br \/>\n        }<br \/>\n    }<br \/>\n    return 0;<br \/>\n} <\/p>\n<h2 id=\"while%E5%BE%AA%E7%8E%AF\" style=\"background-color:transparent\">while\u5faa\u73af<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0while \u5faa\u73af\u662f\u4f60\u4e0d\u7528\u544a\u8bc9\u7a0b\u5e8f\u8981\u5faa\u73af\u591a\u5c11\u6b21&#xff0c;\u53ea\u544a\u8bc9\u5b83 \u201c\u4ec0\u4e48\u65f6\u5019\u505c\u201d&#xff0c;\u7a0b\u5e8f\u5c31\u4e00\u76f4\u5faa\u73af&#xff0c;\u76f4\u5230\u6ee1\u8db3\u505c\u6b62\u6761\u4ef6\u4e3a\u6b62\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6bd4\u5982&#xff1a;\u201c\u8ba9\u7528\u6237\u8f93\u5165\u6570\u5b57&#xff0c;\u76f4\u5230\u8f93\u5165 0 \u4e3a\u6b62\u201d\u201c\u731c\u6570\u5b57\u6e38\u620f&#xff0c;\u76f4\u5230\u731c\u5bf9\u4e3a\u6b62\u201d&#xff0c;\u4e0d\u77e5\u9053\u5faa\u73af\u6b21\u6570&#xff0c;\u7528 while \u6700\u9002\u5408\u3002<\/p>\n<p>\/\/ \u6b65\u9aa41&#xff1a;\u521d\u59cb\u5316\u8ba1\u6570\u5668\/\u53d8\u91cf&#xff08;\u5fc5\u987b\u5199\u5728while\u5916\u9762&#xff09;<br \/>\n\u521d\u59cb\u5316\u8868\u8fbe\u5f0f;<\/p>\n<p>\/\/ \u6b65\u9aa42&#xff1a;while\u5faa\u73af\u6838\u5fc3<br \/>\nwhile (\u5faa\u73af\u6761\u4ef6\u8868\u8fbe\u5f0f)<br \/>\n{<br \/>\n    \/\/ \u5faa\u73af\u4f53&#xff1a;\u91cd\u590d\u6267\u884c\u7684\u4ee3\u7801<br \/>\n    \u91cd\u590d\u6267\u884c\u7684\u4ee3\u7801;<\/p>\n<p>    \/\/ \u6b65\u9aa43&#xff1a;\u66f4\u65b0\u8ba1\u6570\u5668&#xff08;\u5fc5\u987b\u5199\u5728\u5faa\u73af\u4f53\u91cc&#xff0c;\u5426\u5219\u6b7b\u5faa\u73af&#xff09;<br \/>\n    \u66f4\u65b0\u8868\u8fbe\u5f0f;<br \/>\n} <\/p>\n<p>while\u5faa\u73af&#xff1a;\u5148\u5224\u65ad\u6761\u4ef6\u518d\u6267\u884c&#xff0c;\u7075\u6d3b&#xff0c;\u9002\u7528\u4e8e\u4e0d\u77e5\u9053\u300c\u5faa\u73af\u6b21\u6570\u300d&#xff0c;\u53ea\u77e5\u9053\u300c\u505c\u6b62\u6761\u4ef6\u300d&#xff08;\u6bd4\u5982\u76f4\u5230\u7528\u6237\u8f93\u5165 0 \u4e3a\u6b62&#xff09;\u3002<\/p>\n<\/p>\n<h3 id=\"%E4%B8%BE%E4%BE%8B%E8%AF%B4%E6%98%8E\" style=\"background-color:transparent\">\u4e3e\u4f8b\u8bf4\u660e<\/h3>\n<p>int grape &#061; 5; \/\/ \u521d\u59cb\u5316&#xff1a;\u76d8\u5b50\u91cc\u67095\u9897\u8461\u8404<br \/>\nwhile (grape &gt; 0) \/\/ \u6761\u4ef6&#xff1a;\u8461\u8404\u6570&gt;0&#xff08;\u6709\u8461\u8404\u5c31\u7ee7\u7eed\u5403&#xff09;<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u5403\u4e861\u9897\u8461\u8404&#xff0c;\u8fd8\u5269&#034; &lt;&lt; grape-1 &lt;&lt; &#034;\u9897&#034; &lt;&lt; endl;<br \/>\n    grape&#8211;; \/\/ \u66f4\u65b0&#xff1a;\u6bcf\u54031\u9897&#xff0c;\u8461\u8404\u6570\u51cf1<br \/>\n}<br \/>\ncout &lt;&lt; &#034;\u8461\u8404\u5403\u5b8c\u4e86&#xff01;&#034; &lt;&lt; endl; <\/p>\n<h3 id=\"while%20%E5%BE%AA%E7%8E%AF%E7%9A%84%E6%89%A7%E8%A1%8C%E6%B5%81%E7%A8%8B\">while \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b<\/h3>\n<li>\u6267\u884c\u521d\u59cb\u5316&#xff08;\u53ea\u505a 1 \u6b21&#xff09;&#xff1b;<\/li>\n<li>\u5224\u65ad\u5faa\u73af\u6761\u4ef6&#xff1a;\n<ul>\n<li>\u771f \u2192 \u6267\u884c\u5faa\u73af\u4f53 \u2192 \u6267\u884c\u66f4\u65b0 \u2192 \u56de\u5230\u6b65\u9aa4 2&#xff1b;<\/li>\n<li>\u5047 \u2192 \u9000\u51fa\u5faa\u73af&#xff1b;<\/li>\n<\/ul>\n<\/li>\n<li>\u6267\u884c\u5faa\u73af\u540e\u7684\u4ee3\u7801\u3002<\/li>\n<h3 id=\"%E7%BB%83%E4%B9%A0%EF%BC%9A%EF%BC%88%E8%87%AA%E5%B7%B1%E5%8A%A8%E6%89%8B%E5%86%99%E4%B8%80%E4%B8%8B%EF%BC%89\" style=\"background-color:transparent\">\u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09;<\/h3>\n<p>1&#xff1a;\u7528\u6237\u8f93\u5165\u6570\u5b57&#xff0c;\u76f4\u5230\u8f93\u5165 0 \u4e3a\u6b62<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<br \/>\nint main() {<br \/>\n    int num;<br \/>\n    cout &lt;&lt; &#034;\u8bf7\u8f93\u5165\u6570\u5b57&#xff08;\u8f93\u51650\u9000\u51fa&#xff09;&#xff1a;&#034; &lt;&lt; endl;<br \/>\n    cin &gt;&gt; num; \/\/ \u521d\u59cb\u5316&#xff1a;\u5148\u8f93\u5165\u4e00\u6b21\u6570\u5b57<\/p>\n<p>    while (num !&#061; 0) \/\/ \u6761\u4ef6&#xff1a;\u8f93\u5165\u7684\u6570\u5b57\u4e0d\u662f0<br \/>\n    {<br \/>\n        cout &lt;&lt; &#034;\u4f60\u8f93\u5165\u7684\u6570\u5b57\u662f&#xff1a;&#034; &lt;&lt; num &lt;&lt; endl;<br \/>\n        cin &gt;&gt; num; \/\/ \u66f4\u65b0&#xff1a;\u91cd\u65b0\u8f93\u5165\u6570\u5b57&#xff08;\u5173\u952e&#xff01;\u5426\u5219\u6b7b\u5faa\u73af&#xff09;<br \/>\n    }<br \/>\n    cout &lt;&lt; &#034;\u8f93\u5165\u4e860&#xff0c;\u7a0b\u5e8f\u9000\u51fa&#xff01;&#034; &lt;&lt; endl;<br \/>\n    return 0;<br \/>\n} <\/p>\n<p>2&#xff1a;\u731c\u6570\u5b57\u6e38\u620f&#xff08;\u76f4\u5230\u731c\u5bf9\u4e3a\u6b62&#xff09;<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<br \/>\nint main() {<br \/>\n    int target &#061; 7; \/\/ \u8981\u731c\u7684\u6570\u5b57<br \/>\n    int guess;<br \/>\n    cout &lt;&lt; &#034;\u731c\u6570\u5b57\u6e38\u620f&#xff08;1-10&#xff09;&#xff1a;&#034; &lt;&lt; endl;<br \/>\n    cin &gt;&gt; guess;<\/p>\n<p>    while (guess !&#061; target) \/\/ \u6ca1\u731c\u5bf9\u5c31\u7ee7\u7eed\u731c<br \/>\n    {<br \/>\n        cout &lt;&lt; &#034;\u731c\u9519\u4e86&#xff01;\u518d\u8bd5\u8bd5&#xff1a;&#034; &lt;&lt; endl;<br \/>\n        cin &gt;&gt; guess;<br \/>\n    }<br \/>\n    cout &lt;&lt; &#034;\u606d\u559c\u4f60&#xff0c;\u731c\u5bf9\u4e86&#xff01;&#034; &lt;&lt; endl;<br \/>\n    return 0;<br \/>\n} <\/p>\n<h2 id=\"do-while%20%E5%BE%AA%E7%8E%AF%EF%BC%88%E8%87%B3%E5%B0%91%E6%89%A7%E8%A1%8C%E4%B8%80%E6%AC%A1%EF%BC%89\">do-while \u5faa\u73af&#xff08;\u81f3\u5c11\u6267\u884c\u4e00\u6b21&#xff09;<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0do-while \u5faa\u73af\u662f\u300c\u5148\u505a\u4e8b&#xff0c;\u540e\u68c0\u67e5\u300d\u2014\u2014 \u4e0d\u7ba1\u6761\u4ef6\u6ee1\u8db3\u4e0d\u6ee1\u8db3&#xff0c;\u5148\u6267\u884c\u4e00\u6b21\u5faa\u73af\u4f53&#xff0c;\u518d\u5224\u65ad\u6761\u4ef6\u662f\u5426\u7ee7\u7eed\u5faa\u73af\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6bd4\u5982&#xff1a;\u201c\u5bc6\u7801\u8f93\u5165\u201d\u2014\u2014 \u5fc5\u987b\u5148\u8ba9\u7528\u6237\u8f93\u4e00\u6b21\u5bc6\u7801&#xff0c;\u518d\u5224\u65ad\u5bf9\u4e0d\u5bf9&#xff0c;\u4e0d\u5bf9\u5c31\u7ee7\u7eed\u8f93&#xff0c;\u8fd9\u65f6\u5019\u7528 do-while \u6700\u8d34\u5408\u9700\u6c42\u3002<\/p>\n<p>\u5b83\u548c while \u7684\u552f\u4e00\u533a\u522b&#xff1a;<\/p>\n<ul>\n<li>while \u662f \u201c\u5148\u5224\u65ad\u540e\u6267\u884c\u201d&#xff08;\u53ef\u80fd\u4e00\u6b21\u90fd\u4e0d\u6267\u884c&#xff09;<\/li>\n<li>do-while \u662f \u201c\u5148\u6267\u884c\u540e\u5224\u65ad\u201d&#xff08;\u81f3\u5c11\u6267\u884c\u4e00\u6b21&#xff09;<\/li>\n<\/ul>\n<p>\/\/ \u6b65\u9aa41&#xff1a;\u521d\u59cb\u5316\u8ba1\u6570\u5668\/\u53d8\u91cf<br \/>\n\u521d\u59cb\u5316\u8868\u8fbe\u5f0f;<\/p>\n<p>\/\/ \u6b65\u9aa42&#xff1a;do-while\u6838\u5fc3<br \/>\ndo<br \/>\n{<br \/>\n    \/\/ \u5faa\u73af\u4f53&#xff1a;\u81f3\u5c11\u6267\u884c\u4e00\u6b21\u7684\u4ee3\u7801<br \/>\n    \u91cd\u590d\u6267\u884c\u7684\u4ee3\u7801;<\/p>\n<p>    \/\/ \u6b65\u9aa43&#xff1a;\u66f4\u65b0\u8ba1\u6570\u5668<br \/>\n    \u66f4\u65b0\u8868\u8fbe\u5f0f;<br \/>\n} while (\u5faa\u73af\u6761\u4ef6\u8868\u8fbe\u5f0f); \/\/ \u6ce8\u610f&#xff1a;\u672b\u5c3e\u5fc5\u987b\u52a0\u5206\u53f7&#xff01; <\/p>\n<h3 id=\"%E4%B8%BE%E4%BE%8B%E8%AF%B4%E6%98%8E\">\u4e3e\u4f8b\u8bf4\u660e<\/h3>\n<p>string pwd; \/\/ \u5b58\u50a8\u5bc6\u7801<br \/>\ndo<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8bf7\u8f93\u5165\u5bc6\u7801&#xff1a;&#034; &lt;&lt; endl;<br \/>\n    cin &gt;&gt; pwd; \/\/ \u5148\u8f93\u5165\u4e00\u6b21\u5bc6\u7801&#xff08;\u81f3\u5c11\u6267\u884c&#xff09;<\/p>\n<p>} while (pwd !&#061; &#034;123456&#034;); \/\/ \u5bc6\u7801\u4e0d\u5bf9\u5c31\u7ee7\u7eed\u8f93<\/p>\n<p>cout &lt;&lt; &#034;\u5bc6\u7801\u6b63\u786e&#xff0c;\u767b\u5f55\u6210\u529f&#xff01;&#034; &lt;&lt; endl; <\/p>\n<h3 id=\"do-while%20%E5%BE%AA%E7%8E%AF%E7%9A%84%E6%89%A7%E8%A1%8C%E6%B5%81%E7%A8%8B\" style=\"background-color:transparent\">do-while \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b<\/h3>\n<li>\u6267\u884c\u521d\u59cb\u5316&#xff08;\u53ea\u505a 1 \u6b21&#xff09;&#xff1b;<\/li>\n<li>\u6267\u884c\u5faa\u73af\u4f53&#xff08;\u5fc5\u987b\u505a 1 \u6b21&#xff09;&#xff1b;<\/li>\n<li>\u6267\u884c\u66f4\u65b0\u8868\u8fbe\u5f0f&#xff1b;<\/li>\n<li>\u5224\u65ad\u5faa\u73af\u6761\u4ef6&#xff1a;\n<ul>\n<li>\u771f \u2192 \u56de\u5230\u6b65\u9aa4 2&#xff0c;\u7ee7\u7eed\u5faa\u73af&#xff1b;<\/li>\n<li>\u5047 \u2192 \u9000\u51fa\u5faa\u73af&#xff1b;<\/li>\n<\/ul>\n<\/li>\n<li>\u6267\u884c\u5faa\u73af\u540e\u7684\u4ee3\u7801\u3002<\/li>\n<h3 id=\"%E7%BB%83%E4%B9%A0%EF%BC%9A%EF%BC%88%E8%87%AA%E5%B7%B1%E5%8A%A8%E6%89%8B%E5%86%99%E4%B8%80%E4%B8%8B%EF%BC%89\">\u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09;<\/h3>\n<p>\u5bc6\u7801\u9a8c\u8bc1<\/p>\n<p>#include &lt;iostream&gt;<br \/>\n#include &lt;string&gt; \/\/ \u7528string\u9700\u8981\u5305\u542b\u8fd9\u4e2a\u5934\u6587\u4ef6<br \/>\nusing namespace std;<br \/>\nint main() {<br \/>\n    string correct_pwd &#061; &#034;666888&#034;; \/\/ \u6b63\u786e\u5bc6\u7801<br \/>\n    string input_pwd;<\/p>\n<p>    do<br \/>\n    {<br \/>\n        cout &lt;&lt; &#034;\u8bf7\u8f93\u5165\u767b\u5f55\u5bc6\u7801&#xff1a;&#034;;<br \/>\n        cin &gt;&gt; input_pwd;<br \/>\n        if (input_pwd !&#061; correct_pwd)<br \/>\n        {<br \/>\n            cout &lt;&lt; &#034;\u5bc6\u7801\u9519\u8bef&#xff0c;\u8bf7\u91cd\u65b0\u8f93\u5165&#xff01;&#034; &lt;&lt; endl;<br \/>\n        }<br \/>\n    } while (input_pwd !&#061; correct_pwd); \/\/ \u5bc6\u7801\u4e0d\u5bf9\u5c31\u5faa\u73af<\/p>\n<p>    cout &lt;&lt; &#034;\u5bc6\u7801\u6b63\u786e&#xff0c;\u6210\u529f\u767b\u5f55\u7cfb\u7edf&#xff01;&#034; &lt;&lt; endl;<br \/>\n    return 0;<br \/>\n} <\/p>\n<h2 id=\"break%E5%92%8Ccontinue%E8%AF%AD%E5%8F%A5\">break\u548ccontinue\u8bed\u53e5<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5b66\u4f1a\u4e86\u57fa\u672c\u5faa\u73af\u540e&#xff0c;\u8fd8\u9700\u8981\u638c\u63e1\u4e24\u4e2a\u5173\u952e\u5b57&#xff0c;\u624d\u80fd\u66f4\u7075\u6d3b\u5730\u63a7\u5236\u5faa\u73af \u2014\u2014break&#xff08;\u8df3\u51fa\u5faa\u73af&#xff09;\u548ccontinue&#xff08;\u8df3\u8fc7\u672c\u6b21\u5faa\u73af&#xff09;&#xff0c;\u8fd9\u662f\u5faa\u73af\u7684 \u201c\u8fdb\u9636\u64cd\u4f5c\u201d&#xff0c;\u4e5f\u662f\u5b9e\u9645\u5f00\u53d1\u4e2d\u9ad8\u9891\u4f7f\u7528\u7684\u6280\u5de7\u3002<\/p>\n<h3 id=\"break%EF%BC%9A%E7%9B%B4%E6%8E%A5%E9%80%80%E5%87%BA%E6%95%B4%E4%B8%AA%E5%BE%AA%E7%8E%AF%EF%BC%88%E7%BB%88%E6%AD%A2%E5%BE%AA%E7%8E%AF%EF%BC%89\" style=\"background-color:transparent\">break&#xff1a;\u76f4\u63a5\u9000\u51fa\u6574\u4e2a\u5faa\u73af&#xff08;\u7ec8\u6b62\u5faa\u73af&#xff09;<\/h3>\n<p>break\u7684\u4f5c\u7528&#xff1a;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4e00\u65e6\u6267\u884c\u5230 break&#xff0c;\u7acb\u523b\u8df3\u51fa\u5f53\u524d\u6240\u5728\u7684\u5faa\u73af&#xff0c;\u5faa\u73af\u76f4\u63a5\u7ed3\u675f&#xff0c;\u540e\u9762\u7684\u4ee3\u7801\u90fd\u4e0d\u6267\u884c\u3002<\/p>\n<p>\u4e3e\u4f8b&#xff1a;\u5faa\u73af 10 \u6b21&#xff0c;\u4f46\u9047\u5230 5 \u5c31\u9000\u51fa<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<br \/>\nint main() {<br \/>\n    for (int i &#061; 1; i &lt;&#061; 10; i&#043;&#043;)<br \/>\n    {<br \/>\n        if (i &#061;&#061; 5)<br \/>\n        {<br \/>\n            break; \/\/ \u9047\u52305&#xff0c;\u9000\u51fa\u6574\u4e2a\u5faa\u73af<br \/>\n        }<br \/>\n        cout &lt;&lt; &#034;\u5f53\u524d\u6570\u5b57&#xff1a;&#034; &lt;&lt; i &lt;&lt; endl;<br \/>\n    }<br \/>\n    cout &lt;&lt; &#034;\u5faa\u73af\u7ed3\u675f&#xff01;&#034; &lt;&lt; endl;<br \/>\n    return 0;<br \/>\n}<br \/>\n\u8f93\u51fa&#xff1a;<br \/>\n\u5f53\u524d\u6570\u5b57&#xff1a;1<br \/>\n\u5f53\u524d\u6570\u5b57&#xff1a;2<br \/>\n\u5f53\u524d\u6570\u5b57&#xff1a;3<br \/>\n\u5f53\u524d\u6570\u5b57&#xff1a;4<br \/>\n\u5faa\u73af\u7ed3\u675f&#xff01; <\/p>\n<h3 id=\"continue%EF%BC%9A%E8%B7%B3%E8%BF%87%E6%9C%AC%E6%AC%A1%E5%BE%AA%E7%8E%AF%EF%BC%8C%E7%BB%A7%E7%BB%AD%E4%B8%8B%E4%B8%80%E6%AC%A1\">continue&#xff1a;\u8df3\u8fc7\u672c\u6b21\u5faa\u73af&#xff0c;\u7ee7\u7eed\u4e0b\u4e00\u6b21<\/h3>\n<p>continue\u7684\u4f5c\u7528&#xff1a;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8df3\u8fc7\u672c\u6b21\u5faa\u73af\u4f53\u4e2d\u5269\u4e0b\u7684\u4ee3\u7801&#xff0c;\u76f4\u63a5\u6267\u884c\u66f4\u65b0\u8868\u8fbe\u5f0f&#xff0c;\u8fdb\u5165\u4e0b\u4e00\u6b21\u5faa\u73af\u5224\u65ad\u3002<\/p>\n<p>\u4e3e\u4f8b&#xff1a;\u6253\u5370 1-10&#xff0c;\u8df3\u8fc7\u5076\u6570<\/p>\n<p>#include &lt;iostream&gt;<br \/>\nusing namespace std;<br \/>\nint main() {<br \/>\n    for (int i &#061; 1; i &lt;&#061; 10; i&#043;&#043;)<br \/>\n    {<br \/>\n        if (i % 2 &#061;&#061; 0)<br \/>\n        {<br \/>\n            continue; \/\/ \u662f\u5076\u6570\u5c31\u8df3\u8fc7\u672c\u6b21\u5faa\u73af<br \/>\n        }<br \/>\n        cout &lt;&lt; &#034;\u5f53\u524d\u6570\u5b57&#xff1a;&#034; &lt;&lt; i &lt;&lt; endl; \/\/ \u53ea\u6709\u5947\u6570\u4f1a\u6267\u884c\u8fd9\u53e5<br \/>\n    }<br \/>\n    return 0;<br \/>\n}<br \/>\n\u8f93\u51fa&#xff1a;<br \/>\n\u5f53\u524d\u6570\u5b57&#xff1a;1<br \/>\n\u5f53\u524d\u6570\u5b57&#xff1a;3<br \/>\n\u5f53\u524d\u6570\u5b57&#xff1a;5<br \/>\n\u5f53\u524d\u6570\u5b57&#xff1a;7<br \/>\n\u5f53\u524d\u6570\u5b57&#xff1a;9 <\/p>\n<p>\u901a\u4fd7\u7406\u89e3&#xff1a;<\/p>\n<ul>\n<li>break\u7ec8\u6b62\u6574\u4e2a\u5faa\u73af&#xff0c;\u76f8\u5f53\u4e8e\u8dd1\u6b65\u65f6\u7a81\u7136\u809a\u5b50\u75bc&#xff0c;\u76f4\u63a5\u505c\u8dd1&#xff0c;\u4e0d\u8dd1\u4e86<\/li>\n<li>continue\u8df3\u8fc7\u672c\u6b21\u5faa\u73af&#xff0c;\u76f8\u5f53\u4e8e\u8dd1\u6b65\u65f6\u9047\u5230\u6c34\u5751&#xff0c;\u7ed5\u8fc7\u53bb&#xff0c;\u7ee7\u7eed\u8dd1\u4e0b\u4e00\u5708<\/li>\n<\/ul>\n<h2 id=\"%E5%BE%AA%E7%8E%AF%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9\">\u5faa\u73af\u6ce8\u610f\u4e8b\u9879<\/h2>\n<p>1&#xff1a;for \u5faa\u73af\u7684\u6761\u4ef6\u540e\u52a0\u5206\u53f7&#xff08;\u6b7b\u5faa\u73af \/ \u5faa\u73af\u4e0d\u6267\u884c&#xff09;<\/p>\n<p>\/\/ \u9519\u8bef&#xff1a;\u5206\u53f7\u8868\u793a\u5faa\u73af\u4f53\u7ed3\u675f&#xff0c;i&#043;&#043;\u6c38\u8fdc\u4e0d\u6267\u884c&#xff0c;i\u4e00\u76f4\u662f0&#xff0c;\u6b7b\u5faa\u73af<br \/>\nfor (int i&#061;0; i&lt;5; i&#043;&#043;);<br \/>\n{<br \/>\n    cout &lt;&lt; i;<br \/>\n}<\/p>\n<p>\/\/ \u6b63\u786e&#xff1a;for\u540e\u4e0d\u52a0\u4efb\u4f55\u7b26\u53f7&#xff0c;\u5faa\u73af\u4f53\u5199\u5728{}\u91cc<br \/>\nfor (int i&#061;0; i&lt;5; i&#043;&#043;)<br \/>\n{<br \/>\n    cout &lt;&lt; i;<br \/>\n} <\/p>\n<p>2&#xff1a;while\/do-while \u5fd8\u8bb0\u66f4\u65b0\u8ba1\u6570\u5668&#xff08;\u6b7b\u5faa\u73af&#xff09;<\/p>\n<p>int num&#061;5;<br \/>\n\/\/ \u9519\u8bef&#xff1a;\u6ca1\u6709num &#061; num -1&#xff0c;num\u4e00\u76f4\u662f5&#xff0c;\u6761\u4ef6\u6c38\u8fdc\u4e3a\u771f&#xff0c;\u6b7b\u5faa\u73af<br \/>\nwhile(num&gt;0)<br \/>\n{<br \/>\n    cout &lt;&lt; num;<br \/>\n}<\/p>\n<p>\/\/ \u6b63\u786e&#xff1a;\u5faa\u73af\u4f53\u91cc\u5fc5\u987b\u66f4\u65b0\u8ba1\u6570\u5668<br \/>\nwhile(num&gt;0)<br \/>\n{<br \/>\n    cout &lt;&lt; num;<br \/>\n    num&#8211;; \/\/ \u5173\u952e&#xff01;\u6bcf\u6b21\u51cf1<br \/>\n} <\/p>\n<p>3&#xff1a;\u5faa\u73af\u6761\u4ef6\u5199\u6b7b\u4e3a\u771f&#xff08;\u65e0\u6761\u4ef6\u6b7b\u5faa\u73af&#xff09;<\/p>\n<p>\/\/ \u9519\u8bef&#xff1a;\u6761\u4ef6\u662ftrue&#xff0c;\u6c38\u8fdc\u4e3a\u771f&#xff0c;\u6b7b\u5faa\u73af<br \/>\nwhile(true)<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u4e00\u76f4\u8f93\u51fa&#034;;<br \/>\n}<\/p>\n<p>\/\/ \u6b63\u786e&#xff1a;\u52a0break\u63a7\u5236\u9000\u51fa<br \/>\nint i&#061;0;<br \/>\nwhile(true)<br \/>\n{<br \/>\n    cout &lt;&lt; i;<br \/>\n    i&#043;&#043;;<br \/>\n    if(i&gt;&#061;5)<br \/>\n        break; \/\/ \u52305\u5c31\u9000\u51fa<br \/>\n} <\/p>\n<p>4&#xff1a;do-while \u672b\u5c3e\u6f0f\u52a0\u5206\u53f7&#xff08;\u8bed\u6cd5\u9519\u8bef&#xff09;<\/p>\n<p>\/\/ \u9519\u8bef&#xff1a;while\u540e\u6f0f\u5206\u53f7&#xff0c;\u7f16\u8bd1\u62a5\u9519<br \/>\ndo<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;test&#034;;<\/p>\n<p>}while (i&lt;5)<\/p>\n<p>\/\/ \u6b63\u786e&#xff1a;\u672b\u5c3e\u5fc5\u987b\u52a0\u5206\u53f7<br \/>\ndo<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;test&#034;; <\/p>\n<p>}while (i&lt;5); <\/p>\n<p>5&#xff1a;\u5faa\u73af\u53d8\u91cf\u521d\u59cb\u5316\u9519\u8bef&#xff08;\u5faa\u73af\u6b21\u6570\u4e0d\u5bf9&#xff09;<\/p>\n<p>\/\/ \u9519\u8bef&#xff1a;\u60f3\u5faa\u73af5\u6b21&#xff0c;i\u4ece1\u5f00\u59cb&#xff0c;i&lt;&#061;5\u662f5\u6b21&#xff0c;\u4f46\u65b0\u624b\u5bb9\u6613\u5199\u6210i&lt;5&#xff08;\u53ea\u5faa\u73af4\u6b21&#xff09;<br \/>\nfor(int i&#061;1; i&lt;5; i&#043;&#043;) \/\/ \u53ea\u5faa\u73af1-4&#xff0c;\u51714\u6b21<br \/>\n{<br \/>\n    cout &lt;&lt; i;<br \/>\n}<\/p>\n<p>\/\/ \u6b63\u786e&#xff1a;\u6839\u636e\u9700\u6c42\u9009\u6761\u4ef6&#xff0c;1-5\u7528i&lt;&#061;5&#xff0c;0-4\u7528i&lt;5<br \/>\nfor(int i&#061;1; i&lt;&#061;5; i&#043;&#043;) \/\/ \u5faa\u73af1-5&#xff0c;\u51715\u6b21<br \/>\n{<br \/>\n    cout &lt;&lt; i;<br \/>\n} <\/p>\n<p>6&#xff1a;\u7528 continue \u65f6&#xff0c;\u66f4\u65b0\u8bed\u53e5\u5199\u5728 continue \u540e\u9762&#xff08;\u66f4\u65b0\u4e0d\u6267\u884c&#xff09;<\/p>\n<p>\/\/\u9519\u8bef<br \/>\nint i &#061; 1;<br \/>\nwhile(i &lt;&#061; 5) {<br \/>\n    if(i &#061;&#061; 3) {<br \/>\n        continue; \/\/ \u5f53i&#061;3\u65f6&#xff0c;\u4f1a\u5bfc\u81f4\u6b7b\u5faa\u73af<br \/>\n    }<br \/>\n    i&#043;&#043;; \/\/ \u5f53i&#061;3\u65f6&#xff0c;i\u7684\u66f4\u65b0\u64cd\u4f5c\u88abcontinue\u8df3\u8fc7&#xff0c;\u65e0\u6cd5\u66f4\u65b0<br \/>\n    cout &lt;&lt; i;<br \/>\n}<\/p>\n<p>\/\/\u6b63\u786e\u5b9e\u73b0<br \/>\nint i &#061; 1;<br \/>\nwhile(i &lt;&#061; 5) {<br \/>\n    if(i &#061;&#061; 3) {<br \/>\n        i&#043;&#043;; \/\/ \u5728continue\u524d\u66f4\u65b0<br \/>\n        continue;<br \/>\n    }<br \/>\n    i&#043;&#043;; \/\/ \u6b63\u5e38\u66f4\u65b0<br \/>\n    cout &lt;&lt; i;<\/p>\n<p>}<\/p>\n<p>7&#xff1a;\u5faa\u73af\u4f53\u662f\u591a\u884c\u4ee3\u7801\u65f6\u7701\u7565\u5927\u62ec\u53f7&#xff08;\u903b\u8f91\u9519\u8bef&#xff09;<\/p>\n<p>\/\/ \u9519\u8bef&#xff1a;\u53ea\u6709cout\u5c5e\u4e8e\u5faa\u73af&#xff0c;i&#043;&#043;\u4e0d\u5c5e\u4e8e&#xff0c;i\u4e00\u76f4\u662f0&#xff0c;\u6b7b\u5faa\u73af<br \/>\nint i&#061;0;<br \/>\nwhile(i&lt;5)<br \/>\n    cout &lt;&lt; i;<br \/>\n    i&#043;&#043;;<\/p>\n<p>\/\/ \u6b63\u786e&#xff1a;\u591a\u884c\u5faa\u73af\u4f53\u5fc5\u987b\u52a0{}<br \/>\nwhile(i&lt;5)<br \/>\n{<br \/>\n    cout &lt;&lt; i;<br \/>\n    i&#043;&#043;;<br \/>\n} <\/p>\n<p>8&#xff1a;\u6d6e\u70b9\u578b\u53d8\u91cf\u505a\u5faa\u73af\u6761\u4ef6&#xff08;\u7cbe\u5ea6\u95ee\u9898&#xff0c;\u5faa\u73af\u6b21\u6570\u4e0d\u5bf9&#xff09;<\/p>\n<p>\/\/ \u9519\u8bef&#xff1a;\u6d6e\u70b9\u6570\u5b58\u50a8\u4e0d\u7cbe\u786e&#xff0c;0.1&#043;0.2\u22600.3&#xff0c;\u5faa\u73af\u53ef\u80fd\u591a\u6267\u884c\/\u5c11\u6267\u884c<br \/>\nfor(double i&#061;0.1; i&lt;&#061;1.0; i&#043;&#061;0.1)<br \/>\n{<br \/>\n    cout &lt;&lt; i;<br \/>\n}<\/p>\n<p>\/\/ \u6b63\u786e&#xff1a;\u7528\u6574\u6570\u505a\u5faa\u73af\u6761\u4ef6&#xff0c;\u5185\u90e8\u6362\u7b97\u6210\u6d6e\u70b9\u578b<br \/>\nfor(int i&#061;1; i&lt;&#061;10; i&#043;&#043;)<br \/>\n{<br \/>\n    double num &#061; i * 0.1;  \/\/ 0.1\u30010.2&#8230;1.0<br \/>\n    cout &lt;&lt; num;<br \/>\n} <\/p>\n<h2 id=\"%E5%BE%AA%E7%8E%AF%E7%9A%84%E4%BD%BF%E7%94%A8%E5%BB%BA%E8%AE%AE\">\u5faa\u73af\u7684\u4f7f\u7528\u5efa\u8bae<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5f88\u591a\u4eba\u5b66\u5b8c\u4e09\u79cd\u5faa\u73af\u540e&#xff0c;\u4e0d\u77e5\u9053\u8be5\u7528\u54ea\u4e2a&#xff0c;\u8bb0\u4f4f\u4e0b\u9762\u7684\u53e3\u8bc0&#xff0c;\u4e00\u773c\u5c31\u80fd\u9009\u5bf9&#xff1a;<\/p>\n<li>\u77e5\u9053\u5faa\u73af\u6b21\u6570 \u2192 \u7528 for&#xff08;\u6bd4\u5982\u5faa\u73af 10 \u6b21\u30011 \u5230 100&#xff09;&#xff1b;<\/li>\n<li>\u4e0d\u77e5\u9053\u6b21\u6570&#xff0c;\u53ea\u77e5\u9053\u505c\u6b62\u6761\u4ef6 \u2192 \u7528 while&#xff08;\u6bd4\u5982\u76f4\u5230\u8f93\u5165 0 \u4e3a\u6b62&#xff09;&#xff1b;<\/li>\n<li>\u5fc5\u987b\u81f3\u5c11\u6267\u884c\u4e00\u6b21 \u2192 \u7528 do-while&#xff08;\u6bd4\u5982\u5bc6\u7801\u8f93\u5165\u3001\u83dc\u5355\u9009\u62e9&#xff09;&#xff1b;<\/li>\n<li>\u6240\u6709\u80fd\u7528 while\/do-while \u7684\u573a\u666f&#xff0c;\u90fd\u80fd\u6539\u7528 for&#xff0c;\u53cd\u4e4b\u4ea6\u7136 \u2014\u2014 \u6838\u5fc3\u770b\u300c\u4ee3\u7801\u53ef\u8bfb\u6027\u300d&#xff0c;\u54ea\u79cd\u5199\u51fa\u6765\u66f4\u6e05\u6670\u5c31\u7528\u54ea\u79cd\u3002<\/li>\n<h2 id=\"%E7%BB%8F%E5%85%B8%E7%BB%83%E4%B9%A0%E9%A2%98\">\u7ecf\u5178\u7ec3\u4e60\u9898<\/h2>\n<li>\u7528 for \u5faa\u73af\u8ba1\u7b97 1 \u5230 10 \u7684\u9636\u4e58&#xff08;1! &#061;1&#xff0c;2! &#061;1\u00d72&#xff0c;\u202610! &#061;1\u00d72\u00d7\u2026\u00d710&#xff09;&#xff1b;<\/li>\n<li>\u7528 while \u5faa\u73af\u5b9e\u73b0&#xff1a;\u8f93\u5165\u4e00\u4e2a\u6b63\u6574\u6570&#xff0c;\u8ba1\u7b97\u5b83\u7684\u4f4d\u6570&#xff08;\u6bd4\u5982\u8f93\u5165 123&#xff0c;\u8f93\u51fa 3&#xff09;&#xff1b;<\/li>\n<li>\u7528 do-while \u5faa\u73af\u5b9e\u73b0&#xff1a;\u6a21\u62df ATM \u673a\u83dc\u5355&#xff0c;\u81f3\u5c11\u663e\u793a\u4e00\u6b21\u83dc\u5355&#xff0c;\u76f4\u5230\u7528\u6237\u9009\u62e9 \u201c\u9000\u51fa\u201d&#xff1b;<\/li>\n<li>\u7528\u5faa\u73af &#043; break \u5b9e\u73b0&#xff1a;\u6253\u5370 1 \u5230 20&#xff0c;\u9047\u5230\u80fd\u88ab 7 \u6574\u9664\u7684\u6570\u5c31\u9000\u51fa\u5faa\u73af\u3002<\/li>\n<h2 id=\"%E7%BB%93%E5%B0%BE\">\u7ed3\u5c3e<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0OK&#xff0c;\u8fd9\u5c31\u662fC&#043;&#043;\u5b66\u4e60\u8def\u7ebf\u5176\u4e00&#xff1a;\u5165\u95e8\u7bc7\u7684\u7b2c\u516d\u7bc7\u6587\u7ae0&#xff0c;\u8ba9\u5927\u5bb6\u5b66\u4e60\u4e86\u4e09\u79cd\u5faa\u73af\u8bed\u53e5&#xff0c;\u4ee5\u53ca\u4ed6\u4eec\u4e4b\u95f4\u7684\u533a\u522b\u548c\u5177\u4f53\u4f7f\u7528\u65f6\u7684\u6ce8\u610f\u4e8b\u9879\u3002<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u5bf9\u4e8e\u6211\u7684\u6bcf\u7bc7\u6587\u7ae0&#xff0c;\u6211\u90fd\u4f1a\u5c06\u6211\u7684\u5b66\u4e60\u8def\u7ebf\u653e\u5728\u7ed3\u5c3e&#xff0c;\u76ee\u524d\u8fdb\u5ea6\u4e3a&#xff1a;\u7b2c\u4e00\u9636\u6bb5 C&#043;&#043;\u57fa\u672c\u8bed\u6cd5\u5165\u95e8\u7bc7\u7684\u7b2c\u516d\u7bc7\u3002<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u540c\u5fd7\u4eec&#xff0c;\u4e0b\u4e00\u7bc7\u6587\u7ae0\u518d\u89c1&#xff0c;\u6211\u5c3d\u91cf\u4f1a\u4fdd\u6301\u4e00\u5468\u5199\u4e09\u7bc7\u6587\u7ae0&#xff0c;\u8bb0\u5f55\u6211\u7684\u5b66\u4e60\u8fc7\u7a0b&#xff0c;\u5bf9\u4e8eC&#043;&#043;\u7684\u5b66\u4e60\u6211\u6253\u7b97\u6309\u7167\u4e0b\u9762\u7684\u8def\u7ebf\u53bb\u5b66&#xff0c;\u5927\u5bb6\u6709\u6bd4\u6211\u5b66\u7684\u5feb\u7684\u4e5f\u53ef\u4ee5\u6309\u7167\u6211\u7684\u8def\u7ebf\u53bb\u770b\u770b\u81ea\u5df1\u63a5\u4e0b\u6765\u5b66\u4ec0\u4e48\u3002<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0\u7f51\u8bfe\u63a8\u8350&#xff1a;\u9ed1\u9a6c\u7a0b\u5e8f\u5458&#xff0c;\u540c\u65f6\u7ed9\u5927\u5bb6\u63a8\u8350\u4e00\u4f4d\u5927\u4f6c&#xff0c;b\u7ad9\u641c\u7d22\u201c\u604b\u604b\u98ce\u8fb0zack\u201d&#xff0c;\u8fd9\u4e2a\u5927\u4f6c\u7684\u89c6\u9891\u4e5f\u662f\u6211\u4e00\u76f4\u5728\u8ddf\u7740\u5b66\u4e60\u7684&#xff0c;\u8bb2\u7684\u5f88\u597d\u3002<\/p>\n<p>\u5b66\u4e60\u8def\u7ebf&#xff1a;\u4e3b\u653b\u9ad8\u6027\u80fd\u5f00\u53d1&#xff0c;\u5982\u679c\u5927\u5bb6\u50cf\u5b66\u4e60\u6e38\u620f\u5f15\u64ce\u6216\u5d4c\u5165\u5f0f&#xff0c;\u53ef\u4ee5\u81ea\u5df1\u8bbe\u8ba1\u4e00\u4e0b\u5b66\u4e60\u8def\u7ebf<\/p>\n<p>\u7b2c\u4e00\u9636\u6bb5&#xff1a; C&#043;&#043;\u57fa\u672c\u8bed\u6cd5&#xff0c;Git\u5165\u95e8<\/p>\n<p>\u7b2c\u4e8c\u9636\u6bb5&#xff1a;\u719f\u7ec3STL&#xff0c;\u7c7b&#xff0c;\u667a\u80fd\u6307\u9488&#xff0c;\u6a21\u677f&#xff0c;\u51fd\u6570\u7ed1\u5b9a\u7b49\u7b49<\/p>\n<p>\u7b2c\u4e09\u9636\u6bb5&#xff1a;Linux\u57fa\u7840&#xff0c;\u591a\u7ebf\u7a0b&#xff0c; \u7f51\u7edc\u7f16\u7a0b&#xff0c;\u8bbe\u8ba1\u6a21\u5f0f<\/p>\n<p>\u7b2c\u56db\u9636\u6bb5&#xff1a;gRPC&#xff0c;MySQL&#xff0c;Redis&#xff0c;JS&#xff0c;QT&#xff0c;\u6d88\u606f\u961f\u5217&#xff0c;\u624b\u5199\u5404\u79cd\u6c60\u5b50&#xff08;\u7ebf\u7a0b\u6c60\u3001\u5185\u5b58\u6c60&#xff09;<\/p>\n<p>\u7b2c\u4e94\u9636\u6bb5&#xff1a;\u8fdb\u519b\u9ad8\u6027\u80fd\u65b9\u5411&#xff0c;\u5f00\u59cb\u5b66\u4e60 \u4e00\u81f4\u6027\u54c8\u5e0c&#xff0c;\u5206\u5e03\u5f0f\u9501&#xff0c;Raft\u7b97\u6cd5&#xff0c;\u7f51\u7edc\u4f18\u5316\u3001\u5185\u5b58\u4f18\u5316\u3001\u5e76\u53d1\u4f18\u5316<\/p>\n<p>\u7b2c\u516d\u9636\u6bb5&#xff1a;\u771f\u6b63\u5b9e\u73b0\u5de5\u4e1a\u7ea7\u9879\u76ee&#xff0c;\u5728\u6bcf\u4e00\u9636\u6bb5\u7684\u5b66\u4e60\u8fc7\u7a0b\u4e2d\u90fd\u8981\u5199\u4e00\u4e9b\u7ec3\u624b\u7684\u5c0f\u9879\u76ee&#xff0c;\u53ef\u4ee5\u5728GitHub\u4e0a\u627e\u4e00\u4e0b&#xff0c;\u79ef\u5c11\u6210\u591a&#xff0c;\u6700\u7ec8\u53ef\u4ee5\u5b9e\u73b0\u5de5\u4e1a\u7ea7\u9879\u76ee<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55<br \/>\n\u5faa\u73af\u8bed\u53e5<br \/>\nfor\u5faa\u73af<br \/>\n\u4e3e\u4f8b\u8bf4\u660e<br \/>\nfor \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b<br \/>\n\u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09;<br \/>\nwhile\u5faa\u73af<br \/>\n\u4e3e\u4f8b\u8bf4\u660e<br \/>\nwhile \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b<br \/>\n\u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09;<br \/>\ndo-while \u5faa\u73af&#xff08;\u81f3\u5c11\u6267\u884c\u4e00\u6b21&#xff09;<br \/>\n\u4e3e\u4f8b\u8bf4\u660e<br \/>\ndo-while \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b<br \/>\n\u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09;<br \/>\nbreak\u548ccont<\/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,371],"topic":[],"class_list":["post-65950","post","type-post","status-publish","format-standard","hentry","category-server","tag-c","tag-371"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C++\u5b66\u4e60\u8def\u7ebf\u5176\u4e00\uff1a\u5165\u95e8\u7bc7\uff1a6.\u5faa\u73af\u8bed\u53e5 - \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\/65950.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++\u5b66\u4e60\u8def\u7ebf\u5176\u4e00\uff1a\u5165\u95e8\u7bc7\uff1a6.\u5faa\u73af\u8bed\u53e5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u76ee\u5f55 \u5faa\u73af\u8bed\u53e5 for\u5faa\u73af \u4e3e\u4f8b\u8bf4\u660e for \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b \u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09; while\u5faa\u73af \u4e3e\u4f8b\u8bf4\u660e while \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b \u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09; do-while \u5faa\u73af&#xff08;\u81f3\u5c11\u6267\u884c\u4e00\u6b21&#xff09; \u4e3e\u4f8b\u8bf4\u660e do-while \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b \u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09; break\u548ccont\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/65950.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-25T15:32:34+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=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/65950.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/65950.html\",\"name\":\"C++\u5b66\u4e60\u8def\u7ebf\u5176\u4e00\uff1a\u5165\u95e8\u7bc7\uff1a6.\u5faa\u73af\u8bed\u53e5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-25T15:32:34+00:00\",\"dateModified\":\"2026-01-25T15:32:34+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/65950.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/65950.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/65950.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++\u5b66\u4e60\u8def\u7ebf\u5176\u4e00\uff1a\u5165\u95e8\u7bc7\uff1a6.\u5faa\u73af\u8bed\u53e5\"}]},{\"@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++\u5b66\u4e60\u8def\u7ebf\u5176\u4e00\uff1a\u5165\u95e8\u7bc7\uff1a6.\u5faa\u73af\u8bed\u53e5 - \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\/65950.html","og_locale":"zh_CN","og_type":"article","og_title":"C++\u5b66\u4e60\u8def\u7ebf\u5176\u4e00\uff1a\u5165\u95e8\u7bc7\uff1a6.\u5faa\u73af\u8bed\u53e5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u76ee\u5f55 \u5faa\u73af\u8bed\u53e5 for\u5faa\u73af \u4e3e\u4f8b\u8bf4\u660e for \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b \u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09; while\u5faa\u73af \u4e3e\u4f8b\u8bf4\u660e while \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b \u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09; do-while \u5faa\u73af&#xff08;\u81f3\u5c11\u6267\u884c\u4e00\u6b21&#xff09; \u4e3e\u4f8b\u8bf4\u660e do-while \u5faa\u73af\u7684\u6267\u884c\u6d41\u7a0b \u7ec3\u4e60&#xff1a;&#xff08;\u81ea\u5df1\u52a8\u624b\u5199\u4e00\u4e0b&#xff09; break\u548ccont","og_url":"https:\/\/www.wsisp.com\/helps\/65950.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-25T15:32:34+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/65950.html","url":"https:\/\/www.wsisp.com\/helps\/65950.html","name":"C++\u5b66\u4e60\u8def\u7ebf\u5176\u4e00\uff1a\u5165\u95e8\u7bc7\uff1a6.\u5faa\u73af\u8bed\u53e5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-25T15:32:34+00:00","dateModified":"2026-01-25T15:32:34+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/65950.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/65950.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/65950.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"C++\u5b66\u4e60\u8def\u7ebf\u5176\u4e00\uff1a\u5165\u95e8\u7bc7\uff1a6.\u5faa\u73af\u8bed\u53e5"}]},{"@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\/65950","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=65950"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/65950\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=65950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=65950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=65950"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=65950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}