美文网首页
如何判断输入字符种类

如何判断输入字符种类

作者: I_can_code | 来源:发表于2018-03-30 14:22 被阅读0次

include<stdio.h>

int main()
{
char a;
printf("Input simple:\n");
scanf("%c",&a);
if(a>=48&&a<=58)
printf("It is a digit character.\n");
else if(a>=65&&a<=90||a>=97&&a<=122)
printf("It is an English character.\n");
else
printf("It is other character.\n");
return 0;
}
0-9对应的ASCII码:48-58
A-Z对应的ASCII码 : 65-90
a-z对应的ASCII码 : 97-122

相关文章

网友评论

      本文标题:如何判断输入字符种类

      本文链接:https://www.haomeiwen.com/subject/lykicftx.html