<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 程序:檢查字符是否為字母 > 原文: [https://www.programiz.com/c-programming/examples/alphabet](https://www.programiz.com/c-programming/examples/alphabet) #### 在此示例中,您將學習檢查用戶輸入的字符是否為字母。 要理解此示例,您應該了解以下 [C 編程](/c-programming "C tutorial")主題: * [C 編程運算符](/c-programming/c-operators) * [C `if...else`語句](/c-programming/c-if-else-statement) * * * 在 C 編程中,字符變量保存的是 ASCII 值(0 到 127 之間的整數),而不是該字符本身。 小寫字母的 ASCII 值為 97 至 122。大寫字母的 ASCII 值為 65 至 90。 如果用戶輸入的字符的 ASCII 值在 97 到 122 或 65 到 90 的范圍內,則該數字為字母。 ## 檢查字母的程序 ```c #include <stdio.h> int main() { char c; printf("Enter a character: "); scanf("%c", &c); if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) printf("%c is an alphabet.", c); else printf("%c is not an alphabet.", c); return 0; } ``` **輸出** ```c Enter a character: * * is not an alphabet ``` * * * 在程序中,使用`'a'`代替`97`,并且使用`'z'`代替`122`。 類似地,使用`'A'`代替`65`,并且使用`'Z'`代替`90`。 **注意**:建議使用`isalpha()`函數檢查字符是否為字母。
                  <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>

                              哎呀哎呀视频在线观看