精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • 1.編程實(shí)現(xiàn)從鍵盤輸入一個(gè)大寫英文字母,分別以字符形式和ASCII碼值形式輸出其對(duì)應(yīng)的小寫英文字母.

    1.編程實(shí)現(xiàn)從鍵盤輸入一個(gè)大寫英文字母,分別以字符形式和ASCII碼值形式輸出其對(duì)應(yīng)的小寫英文字母.
    其他人氣:446 ℃時(shí)間:2019-08-19 10:30:33
    優(yōu)質(zhì)解答
    #include <stdio.h>
    #include <stdlib.h>

    int main()
    {
        char c;

        scanf("%c", &c);
        if((c <= 'A') || (c >= 'Z'))
        {
            printf("非大寫字母.\n");
        }
        else
        {
            c = c + 32;
            printf("%c %d\n", c, c);
        }

        return 0;
    }如果是輸入小寫字母輸出大寫字母呢?

    這個(gè)需要知道小寫字母和大寫字母在ASCII碼的大小就行了


    A  65   Z 90


    a  97   z  116


    大寫轉(zhuǎn)小寫是+32,小寫轉(zhuǎn)大寫-32就可以了

    #include <stdio.h>
    #include <stdlib.h>
     
    int main()
    {
        char c;
     
        scanf("%c", &c);
        if((c <= 'a') || (c >= 'z'))
        {
            printf("非大寫字母。\n");
        }
        else
        {
            c = c - 32;
            printf("%c %d\n", c, c);
        }
     
        return 0;
    }
    我來回答
    類似推薦
    請(qǐng)使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點(diǎn),以保證最佳閱讀效果。本頁提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機(jī)版