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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # C++ 中的`goto`語句 > 原文: [https://beginnersbook.com/2017/08/cpp-goto-statement/](https://beginnersbook.com/2017/08/cpp-goto-statement/) `goto`語句用于將程序的控制轉移到給定標簽。` goto`語句的語法如下所示: ```cpp goto label_name; ``` **程序結構:** ```cpp label1: ... ... goto label2; ... .. label2: ... ``` 在程序中我們有任意數量的`goto`和`label`語句,`goto`語句后跟一個標簽名稱,每當遇到`goto`語句時,程序的控制權就會跳轉到`goto`語句中指定的標簽。 > `goto`語句幾乎從不在任何開發中使用,因為它們很復雜,使得程序的可讀性更低,更容易出錯。代替`goto`,你可以使用[`continue`](https://beginnersbook.com/2017/08/cpp-continue-statement/)和[`break`語句](https://beginnersbook.com/2017/08/cpp-break-statement/)。 ## C++ 中`goto`語句的示例 ```cpp #include <iostream> using namespace std; int main(){ int num; cout<<"Enter a number: "; cin>>num; if (num % 2==0){ goto print; } else { cout<<"Odd Number"; } print: cout<<"Even Number"; return 0; } ``` **輸出:** ```cpp Enter a number: 42 Even Number ```
                  <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>

                              哎呀哎呀视频在线观看