<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # C 編程的`do-while`循環 > 原文: [https://beginnersbook.com/2014/01/c-dowhile-loop/](https://beginnersbook.com/2014/01/c-dowhile-loop/) 在上一個教程中,我們在 C 中學習[`while`循環](https://beginnersbook.com/2014/01/c-while-loop/)。`do while`循環類似于`while`循環,但有一個例外,它在檢查條件之前執行`do`體內的語句。另一方面,在`while`循環中,首先檢查條件,然后執行`while`循環中的語句。所以你可以說如果條件最初是假的那么`do while`會運行一次,但是`while`循環根本不會運行。 ## C - `do..while`循環 `do-while`循環的語法: ```c do { //Statements }while(condition test); ``` ### `do..while`循環的流程圖 ![C do while loop](https://img.kancloud.cn/c5/33/c533f6827cfa61e8d65e460440677b4e_400x400.jpg) ### `do..while`循環的示例 ```c #include <stdio.h> int main() { int j=0; do { printf("Value of variable j is: %d\n", j); j++; }while (j<=3); return 0; } ``` **輸出:** ```c Value of variable j is: 0 Value of variable j is: 1 Value of variable j is: 2 Value of variable j is: 3 ``` ## C 中的`while` vs `do..while`循環 **使用`while`循環:** ```c #include <stdio.h> int main() { int i=0; while(i==1) { printf("while vs do-while"); } printf("Out of loop"); } ``` **輸出:** ```c Out of loop ``` **使用`do-while`循環**的相同示例: ```c #include <stdio.h> int main() { int i=0; do { printf("while vs do-while\n"); }while(i==1); printf("Out of loop"); } ``` **輸出:** ```c while vs do-while Out of loop ``` **說明:**正如我在本指南開頭所提到的,`do-while`至少運行一次,即使條件為`false`,因為條件被求值,執行循環體之后也是如此。
                  <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>

                              哎呀哎呀视频在线观看