ctype.h( 二 )

isupper函式名称: isupper 函式原型: int isupper(int ch);函式功能: 检查ch是否是大写字母(A-Z)函式返回: 是返回非0,否则返回0参数说明:所属档案: <ctype.h>#include<stdio.h>#include<ctype.h>charchars[]={'A','a','z','Z'};#defineSIZEsizeof(chars)/sizeof(char)int main(){inti;for(i=0;i<SIZE;i++){printf("Char%cis%sanuppercasecharacter\n",chars[i],(isupper(chars[i]))?"":"not");}return0;}tolower函式名称: tolower函式原型: int tolower(int ch);函式功能: 将ch字元转换为小写字母函式返回: 返回ch所代表的字元的小写字母参数说明:所属档案: <ctype.h>#include<stdio.h>#include<stdlib.h>#include<ctype.h>intmain(){charx='a',y='b',z='A',w='*';printf("Character%ctoloweris%c\n",x,tolower(x));printf("Character%ctoloweris%c\n",y,tolower(y));printf("Character%ctoloweris%c\n",z,tolower(z));printf("Character%ctoloweris%c\n",w,tolower(w));return0;}toupper函式名称: toupper函式原型: int toupper(int ch);函式功能: 将ch字元转换成大写字母函式返回: 与ch相应的大写字母参数说明:所属档案: <ctype.h>#include<stdio.h>#include<stdlib.h>#include<ctype.h>int main(){charx='a',y='b',z='A',w='*';printf("Character%ctoupperis%c\n",x,toupper(x));printf("Character%ctoupperis%c\n",y,toupper(y));printf("Character%ctoupperis%c\n",z,toupper(z));printf("Character%ctoupperis%c\n",w,toupper(w));return0;}isalnum函式名称: isalnum函式原型: int isalnum(int ch);函式功能: 检查ch是否是字母或数字函式返回: 是字母或数字返回非0,否则返回0参数说明:所属档案: <ctype.h>【ctype.h】#include<stdio.h>#include<ctype.h>intmain(){charch1='*';charch2='a';if(isalnum(ch1)!=0)printf("%cistheASCIInumberoralphebet\n",ch1);elseprintf("%cisnottheASCIInumbernoralphebet\n",ch1);if(isalnum(ch2)!=0)printf("%cistheASCIInumberoralphebet\n",ch2);elseprintf("%cisnottheASCIInumbernoralphebet\n",ch2);return0;} isprint函式名称: isprint函式原型: int isprint(int ch);函式功能: 检查ch是否是可列印字元(包括空格),其ASCII码在0x20到0x7E之间函式返回: 是返回非0,否则返回0参数说明:所属档案: <ctype.h>#include<stdio.h>#include<ctype.h>intmain(){charch1='\n';charch2='a';if(isprint(ch1)!=0)printf("%cistheASCIIprintablecharcater\n",ch1);elseprintf("%cisnottheASCIIprintablecharcater\n",ch1);if(isprint(ch2)!=0)printf("%cistheASCIIprintablecharcater\n",ch2);elseprintf("%cisnottheASCIIprintablecharcater\n",ch2);return0;}ispunct函式名称: ispunct函式原型: int ispunct(int ch);函式功能: 检查ch是否是标点字元(不包括空格),即除字母,数字和空格以外的所有可列印字元函式返回: 是返回非0,否则返回0参数说明:所属档案: <ctype.h>#include<stdio.h>#include<ctype.h>intmain(){charch1=',';charch2='a';if(ispunct(ch1)!=0)printf("%cistheASCIIpunct\n",ch1);elseprintf("%cisnottheASCIIpunct\n",ch1);if(ispunct(ch2)!=0)printf("%cistheASCIIpunct\n",ch2);elseprintf("%cisnottheASCIIpunct\n",ch2);return0;}isspace函式名称: isspace函式原型: int isspace(int ch);函式功能: 检查ch是否是空格符和跳格符(控制字元)或换行符函式返回: 是返回非0,否则返回0参数说明:所属档案: <ctype.h>#include<stdio.h>#include<ctype.h>intmain(){charch1='';charch2='a';if(isspace(ch1)!=0)printf("%cisthespacecharcater\n",ch1);elseprintf("%cisnotthespacecharcater\n",ch1);if(isspace(ch2)!=0)printf("%cisthespacecharcater\n",ch2);elseprintf("%cisnotthespacecharcater\n",ch2);return0;}