#include "stdio.h"void main(){char c;printf("please input a character:");c=getchar(); if(c < 32){printf("This is a control character\n");}else if("c >= '0' && c<='9'"){printf("This is an integer\n");}else if ("c>='a' && c<= 'z'"){printf("This is a small letter\n");}else if ("c>='A' && c<='Z'"){printf("This is a capital letter\n");}else{printf("This is another character\n");}}这个程序我本来是想随便输一个符号就能帮我自动归类但是不管输入什么都说这是一个整数怎么回事?
2 回答
小唯快跑啊
TA贡献1863条经验 获得超2个赞
#include "stdio.h"
void main()
{
char c;
printf("please input a character:");
c=getchar();
if(c < 32)
{
printf("This is a control character\n");
}
else if((c >= '0') && (c<='9'))
{
printf("This is an integer\n");
}
else if ((c>='a') && (c<= 'z'))
{
printf("This is a small letter\n");
}
else if ((c>='A') && (c<='Z'))
{
printf("This is a capital letter\n");
}
else
{
printf("This is another character\n");
}
}
添加回答
举报
0/150
提交
取消