<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # C++ 中的`continue`語句 > 原文: [https://beginnersbook.com/2017/08/cpp-continue-statement/](https://beginnersbook.com/2017/08/cpp-continue-statement/) 在循環內使用`continue`語句。每當在循環內遇到`continue`語句時,控制流直接跳轉到循環的開頭以進行下一次迭代,跳過循環體內當前迭代的語句的執行。 #### `continue`語句的語法 ```cpp continue; ``` ## 示例:`for`循環中的`continue`語句 正如你可以看到輸出缺少值 3,但循環迭代`num`值 0 到 6。這是因為我們在循環中設置了一個條件,這種情況下當`num`值等于 3 時遇到語句。因此,對于此迭代,循環跳過`cout`語句并開始下一次循環迭代。 ```cpp #include <iostream> using namespace std; int main(){ for (int num=0; num<=6; num++) { /* This means that when the value of * num is equal to 3 this continue statement * would be encountered, which would make the * control to jump to the beginning of loop for * next iteration, skipping the current iteration */ if (num==3) { continue; } cout<<num<<" "; } return 0; } ``` **輸出:** ```cpp 0 1 2 4 5 6 ``` ## `continue`語句的流程圖 ![C++ continue statement](https://img.kancloud.cn/5f/f0/5ff0abe92e9f78b98451df7d3022d000_400x400.jpg) ## 示例:在`while`循環中使用`continue` ```cpp #include <iostream> using namespace std; int main(){ int j=6; while (j >=0) { if (j==4) { j--; continue; } cout<<"Value of j: "<<j<<endl; j--; } return 0; } ``` **輸出:** ```cpp Value of j: 6 Value of j: 5 Value of j: 3 Value of j: 2 Value of j: 1 Value of j: 0 ``` ## `do-while`循環中`continue`的示例 ```cpp #include <iostream> using namespace std; int main(){ int j=4; do { if (j==7) { j++; continue; } cout<<"j is: "<<j<<endl; j++; }while(j<10); return 0; } ``` **輸出:** ```cpp j is: 4 j is: 5 j is: 6 j is: 8 j is: 9 ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看