乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      ctype.h里的函數(shù)

       小菜鳥(niǎo)020 2011-03-23
      ctype.h里的函數(shù)
        1 字符測(cè)試函數(shù)
        1> 函數(shù)原型均為int isxxxx(int)
        2> 參數(shù)為int, 任何實(shí)參均被提升成整型
        3> 只能正確處理處于[0, 127]之間的值
        2 字符映射函數(shù)
        1> 函數(shù)原型為int toxxxx(int)
        2> 對(duì)參數(shù)進(jìn)行檢測(cè), 若符合范圍則轉(zhuǎn)換, 否則不變
        int tolower(int); 'A'~'Z' ==> 'a'~'z'
        int toupper(int); 'a'~'z' ==> 'A'~'Z'
        @函數(shù)名稱: isalpha
        函數(shù)原型: int isalpha(int ch);
        函數(shù)功能: 檢查ch是否是字母.
        函數(shù)返回: 是字母返回1 ,否則返回 0.
        參數(shù)說(shuō)明:
        所屬文件 <ctype.h>
        #include <stdio.h>
        #include <ctype.h>
        int main()
        {
        char ch1='*';
        char ch2='a';
        if(isalnum(ch1)!=0)
        printf("%c is the ASCII number or alphebet\n",ch1);
        else
        printf("%c is not the ASCII number nor alphebet\n",ch1);
        if(isalnum(ch2)!=0)
        printf("%c is the ASCII number or alphebet\n",ch2);
        else
        printf("%c is not the ASCII number nor alphebet\n",ch2);
        return 0;
        }
        @函數(shù)名稱: iscntrl
        函數(shù)原型: int iscntrl(int ch);
        函數(shù)功能: 檢查ch是否控制字符(其ASCII碼在0和0x1F之間,數(shù)值為 0-31).
        函數(shù)返回: 是返回 1,否則返回 0.
        參數(shù)說(shuō)明:
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include <ctype.h>
        char chars[]={'A',0x09,'Z'};
        #define SIZE sizeof(chars)/sizeof(char)
        int main()
        {
        int i;
        for(i=0;i<SIZE;i++){
        printf("Char %c is %sa Control character\n",
        chars,(iscntrl(chars))?"":"not");
        }
        return 0;
        }
        @函數(shù)名稱: isdigit
        函數(shù)原型: int isdigit(int ch);
        函數(shù)功能: 檢查ch是否是數(shù)字(0-9)
        函數(shù)返回: 是返回1,否則返回0
        參數(shù)說(shuō)明:
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include <ctype.h>
        int main()
        {
        char ch1='1';
        char ch2='a';
        if(isdigit(ch1)!=0)
        printf("%c is the ASCII number\n",ch1);
        else
        printf("%c is not the ASCII number\n",ch1);
        if(isdigit(ch2)!=0)
        printf("%c is the ASCII number\n",ch2);
        else
        printf("%c is not the ASCII number\n",ch2);
        return 0;
        }
        @函數(shù)名稱: isgraph
        函數(shù)原型: int isgraph(int ch);
        函數(shù)功能: 檢查ch是否可顯示字符(其ASCII碼在ox21到ox7E之間),不包括空格
        函數(shù)返回: 是返回1,否則返回0
        參數(shù)說(shuō)明:
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include <ctype.h>
        int main()
        {
        char ch1=' ';
        char ch2='a';
        if(isgraph(ch1)!=0)
        printf("%c is the ASCII printable character\n",ch1);
        else
        printf("%c is not the ASCII printable character\n",ch1);
        if(isgraph(ch2)!=0)
        printf("%c is the ASCII printable character\n",ch2);
        else
        printf("%c is not the ASCII printable character\n",ch2);
        return 0;
        }
        @函數(shù)名稱: islower
        函數(shù)原型: int islower(int ch);
        函數(shù)功能: 檢查ch是否小寫(xiě)字母(a-z)
        函數(shù)返回: 是返回1,否則返回0
        參數(shù)說(shuō)明:
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include <ctype.h>
        char chars[]={'A','a','z','Z'};
        #define SIZE sizeof(chars)/sizeof(char)
        int main()
        {
        int i;
        for(i=0;i<SIZE;i++){
        printf("Char %c is %sa lowercase character\n",chars,(islower(chars))?"":"not");
        }
        return 0;
        }
        @函數(shù)名稱: tolower
        函數(shù)原型: int tolower(int ch);
        函數(shù)功能: 將ch字符轉(zhuǎn)換為小寫(xiě)字母
        函數(shù)返回: 返回ch所代表的字符的小寫(xiě)字母
        參數(shù)說(shuō)明:
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include <stdlib.h>
        #include <ctype.h>
        int main()
        {
        char x='a', y='b',z='A',w='*';
        printf("Character %c to lower is %c\n",x,tolower(x));
        printf("Character %c to lower is %c\n",y,tolower(y));
        printf("Character %c to lower is %c\n",z,tolower(z));
        printf("Character %c to lower is %c\n",w,tolower(w));
        return 0;
        }
        @函數(shù)名稱: toupper
        函數(shù)原型: int toupper(int ch);
        函數(shù)功能: 將ch字符轉(zhuǎn)換成大寫(xiě)字母
        函數(shù)返回: 與ch相應(yīng)的大寫(xiě)字母
        參數(shù)說(shuō)明:
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include <stdlib.h>
        #include <ctype.h>
        int main()
        {
        char x='a', y='b',z='A',w='*';
        printf("Character %c to upper is %c\n",x,toupper(x));
        printf("Character %c to upper is %c\n",y,toupper(y));
        printf("Character %c to upper is %c\n",z,toupper(z));
        printf("Character %c to upper is %c\n",w,toupper(w));
        return 0;
        }
        @函數(shù)名稱: isalnum
        函數(shù)原型: int isalnum(int ch);
        函數(shù)功能: 檢查ch是否是字母或數(shù)字
        函數(shù)返回: 是字母或數(shù)字返回1,否則返回0
        參數(shù)說(shuō)明:
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include <ctype.h>
        int main()
        {
        char ch1 ='*';
        char ch2 ='a';
        if(isalnum(ch1)!=0)
        printf("%c is the ASCII number or alphebet\n",ch1);
        else
        printf("%c is not the ASCII number nor alphebet\n",ch1);
        if(isalnum(ch2)!=0)
        printf("%c is the ASCII number or alphebet\n",ch2);
        else
        printf("%c is not the ASCII number nor alphebet\n",ch2);
        return 0;
        }
        @函數(shù)名稱: isprint
        函數(shù)原型: int isprint(int ch);
        函數(shù)功能: 檢查ch是否是可打印字符(包括空格),其ASCII碼在ox20到ox7E之間
        函數(shù)返回: 是返回1,否則返回0
        參數(shù)說(shuō)明:
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include <ctype.h>
        int main()
        {
        char ch1='\n';
        char ch2='a';
        if(isprint(ch1)!=0)
        printf("%c is the ASCII printable charcater\n",ch1);
        else
        printf("%c is not the ASCII printable charcater\n",ch1);
        if(isprint(ch2)!=0)
        printf("%c is the ASCII printable charcater\n",ch2);
        else
        printf("%c is not the ASCII printable charcater\n",ch2);
        return 0;
        }
        @函數(shù)名稱: ispunct
        函數(shù)原型: int ispunct(int ch);
        函數(shù)功能: 檢查ch是否是標(biāo)點(diǎn)字符(不包括空格),即除字母,數(shù)字和空格以外的所有可打印字符
        函數(shù)返回: 是返回1,否則返回0
        參數(shù)說(shuō)明:
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include<ctype.h>
        int main()
        {
        char ch1=',';
        char ch2='a';
        if(ispunct(ch1)!=0)
        printf("%c is the ASCII punct\n",ch1);
        else
        printf("%c is not the ASCII punct\n",ch1);
        if(ispunct(ch2)!=0)
        printf("%c is the ASCII punct\n",ch2);
        else
        printf("%c is not the ASCII punct\n",ch2);
        return 0;
        }
        @函數(shù)名稱: isspace
        函數(shù)原型: int isspace(int ch);
        函數(shù)功能: 檢查ch是否是空格符和跳格符(控制字符)或換行符
        函數(shù)返回: 是返回1,否則返回0
        參數(shù)說(shuō)明:
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include <ctype.h>
        int main()
        {
        char ch1=' ';
        char ch2='a';
        if(isspace(ch1)!=0)
        printf("%c is the space charcater\n",ch1);
        else
        printf("%c is not the space charcater\n",ch1);
        if(isspace(ch2)!=0)
        printf("%c is the space charcater\n",ch2);
        else
        printf("%c is not the space charcater\n",ch2);
        return 0;
        }
        @函數(shù)名稱: isupper
        函數(shù)原型: int isupper(int ch);
        函數(shù)功能: 檢查ch是否是大寫(xiě)字母(A-Z)
        函數(shù)返回: 是返回1,否則返回0
        參數(shù)說(shuō)明:
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include <ctype.h>
        char chars[]={'A','a','z','Z'};
        #define SIZE sizeof(chars)/sizeof(char)
        int main()
        {
        int i;
        for(i=0;i<SIZE;i++){
        printf("Char %c is %san uppercase character\n",
        chars,(isupper(chars))?"":"not");
        }
        return 0;
        }
        @函數(shù)名稱: isxdigit
        函數(shù)原型: int isxdigit(int ch);
        函數(shù)功能: 檢查ch是否是一個(gè)16進(jìn)制數(shù)學(xué)字符(即0-9,或A-F,或a-f)
        函數(shù)返回: 是返回 1,否則返回0
        參數(shù)說(shuō)明:
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include <ctype.h>
        int main()
        {
        char ch1='1';
        char ch2='a';
        if(isxdigit(ch1)!=0)
        printf("%c is the ASCII hexadecimal number\n",ch1);
        else
        printf("%c is not the ASCII hexadecimal number\n",ch1);
        if(isxdigit(ch2)!=0)
        printf("%c is the ASCII hexadecimal number\n",ch2);
        else
        printf("%c is not the ASCII hexadecimal number\n",ch2);
        return 0;
        }
        @函數(shù)名稱: isascii
        函數(shù)原型: int isascii(int ch)
        函數(shù)功能: 測(cè)試參數(shù)是否是ASCII碼0-127
        函數(shù)返回: 非零-是,0-不是
        參數(shù)說(shuō)明: ch-被測(cè)參數(shù)
        所屬文件: <ctype.h>
        #include <stdio.h>
        #include <ctype.h>
        char chars[]={'A',0x80,'Z'};
        #define SIZE sizeof(chars)/sizeof(char)
        int main()
        {
        int i;
        for(i=0;i<SIZE;i++)
        {
        printf("Char %c is %san ASCII character\n",
        chars,(isascii(chars))?"":"not");
        }
        return 0;
        }

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章