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

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # C++ 程序:查找字符串的長度 > 原文: [https://www.programiz.com/cpp-programming/examples/string-length](https://www.programiz.com/cpp-programming/examples/string-length) #### 在此示例中,您將學習計算字符串(字符串對象和 C 樣式字符串)的長度(大小)。 要理解此示例,您應該了解以下 [C++ 編程](/cpp-programming "C++ tutorial")主題: * [C++ 字符串](/cpp-programming/strings) * * * 您可以使用`size()`函數或`length()`函數獲取字符串對象的長度。 `size()`和`length()`函數只是同義詞,它們都做完全相同的事情。 * * * ## 示例:字符串對象的長度 ```cpp #include <iostream> using namespace std; int main() { string str = "C++ Programming"; // you can also use str.length() cout << "String Length = " << str.size(); return 0; } ``` **輸出** ```cpp String Length = 15 ``` * * * ## 示例:C 樣式字符串的長度 要獲取 C 字符串的長度,可以使用`strlen()`函數。 ```cpp #include <iostream> #include <cstring> using namespace std; int main() { char str[] = "C++ Programming is awesome"; // you can also use str.length() cout << "String Length = " << strlen(str); return 0; } ``` **輸出** ```cpp String Length = 26 ```
                  <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>

                              哎呀哎呀视频在线观看