通过键盘输入字符c,判断该字符是哪一类。注:将字符分为三类:数字、字母和其它字符

来源:百度知道 编辑:UC知道 时间:2024/07/05 13:25:01
不会简单的 帮个忙吧~~~

回答过了、、
#include <stdio.h>

void main()
{
char s;
while(scanf("%c",&s),s!='\n'){
if(s>='0'&&s<='9')
printf("%c是数字\n",s);
if(s>='a'&&s<='z')
printf("%c是小写字母\t",s);
if(s>='A'&&s<='Z')
printf("%c是大写字母\t",s);
else
printf("%c是其他字符\t",s);
}printf("\n");
}//可以连续输入很多字符

是输入一个字符,然后判断它的类型吗?
如果是这样的话。这个还是比较简单的
大概写一下。
int main(int argc ,char*argv[])
{
char c=0;
int i=0;
if(c<=9 && c>=0)
printf("您输入的是数字\n");

else if( (c<='z' && c>='a') ||
(c<='Z' && c>='A') )
//字母的ASCII码的范围
printf("您输入的是字母\n");

else printf("您输入的是其他字符\n");

return 0;
}