#include <stdio.h> // 根据输入的字符判断 是 数字 还是 大小写 字母 int main(void) { char getChars ; printf("请输入随意的字符:\n"); scanf("%c",&getChars); if(getChars >= 48 && getChars <= 57) printf("您输入的字符为数字,输入的为%c",getChars); else if(getChars >= 65 && getChars <= 90) printf("您输入的字符为大写字符,输入的为%c",getChars); else if(getChars >= 97 && getChars <= 122) printf("您输入的字符为小写字符,输入的为%c",getChars); else printf("您输入的字符既不是大小写字符也不是数字,请重新输入"); }
原文:http://www.cnblogs.com/l5wg/p/5182323.html