void Print(const char *str)
{
int alpha = 0;
int num = 0;
int space = 0;
int other = 0;
while(*str != '\0')
{
if(isalpha(*str))//if((65<=*str&&*str<=90) || (97<=*str&&*str<=122))
{
alpha++;
}
else if(isdigit(*str))
{
num++;
}
else if(*str == ' ')
{
space++;
}
else
{
other++;
}
str++;
}
printf("%d %d %d %d\n", alpha, num, space, other);
}
判断字符串
最新推荐文章于 2024-08-14 21:00:35 发布