摘要: 首先要知道控制字符,可打印字符等所对应的ASCII码是多少。 0-31和127 控制字符 32-126 可打印字符 65-90 大写字母 97-122 小写字母 48-57 0-9数字 32 空格 字符类测试库函数所在头文件 <ctype.h> isupper()测试字符是否为大写英文字 ispunct()测试字符是否为标点符号或特殊符号 isspace()测试字符是否为空格字符 isprin... 阅读全文
posted @ 2012-12-04 19:46 helloweworld 阅读(307) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <ctype.h>/*大小写转换的库函数:int tolower(int c)int toupper(int c)*/int my_tolower(unsigned char c){ return (c + ('a' - 'A'));}int my_toupper(unsigned char c){ return (c - ('a' - 'A'... 阅读全文
posted @ 2012-12-04 19:35 helloweworld 阅读(193) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <ctype.h>/*判断是控制字符(ASCII 0-31和127)的库函数:满足指定的条件,返回非0;否则返回0.iscntrl(c)*//*************** * 输入:要判断的字符。 * 输出:是空白,返回1;其他,返回0. **************/int my_iscntrl(unsigned char c){ if (... 阅读全文
posted @ 2012-12-04 19:25 helloweworld 阅读(381) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <ctype.h>/*判断是空白(空格-ASCII 32,换页-12,换行-10,回车-13,横向制表-9,纵向制表-11)的库函数:满足指定的条件,返回非0;否则返回0.isspace(c)*//*************** * 输入:要判断的字符。 * 输出:是空白,返回1;其他,返回0. **************/int my_is... 阅读全文
posted @ 2012-12-04 19:17 helloweworld 阅读(548) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <ctype.h>/*判断是字母或数字的库函数:满足指定的条件,返回非0;否则返回0.isalpha(c)isdigit(c)*//*************** * 输入:要判断的字符。 * 输出:是字母,返回1;其他,返回0. **************/int my_isalpha(unsigned char c){ if ((c >=... 阅读全文
posted @ 2012-12-04 18:57 helloweworld 阅读(166) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <ctype.h>/*判断大小写的库函数:满足指定的条件,返回非0;否则返回0.isupper(c)islower(c)*//*************** * 输入:要判断的字符。 * 输出:是小写,返回1;其他,返回0. **************/int my_islower(unsigned char c){ if (c >= 'a'... 阅读全文
posted @ 2012-12-04 18:48 helloweworld 阅读(769) 评论(0) 推荐(0) 编辑