请各位大大解决~~~~
如何编写一个程序,能分别统计出从键盘上输入的字符串中小写字符的个数、数字字符的个数和其他字符的个数。输入的字符串以“!”作为结束标记。
程序代码:#include<stdio.h>
void main()
{
char *p;
char str[1000];
int i=0;
int low=0,num=0,other=0;
for(;i<1000;i++)
{
char ch=getchar();
if(ch=='!')
break;
else
str[i]=ch;
}
str[i]='\0';
p=&str[0];
while(*p)
{
if(*p>='a'&&*p<='z')
low++;
else if(*p>='0'&&*p<='9')
num++;
else
other++;
p++;
}
printf("\n小写字母:%d,数字:%d,其它:%d\n",low,num,other);
}

程序代码:#include <stdio.h>
#include <ctype.h>
#include <conio.h>
int main(void)
{
char c;
unsigned int aaa=0;
unsigned int bbb=0;
unsigned int ccc=0;
while (c = getch(), '!' != c)
{
if (islower(c))
{
aaa++;
}
else if (isdigit(c))
{
bbb++;
}
else
{
ccc++;
}
}
printf("小写个数:\t%d", aaa);
printf("数字个数:\t%d", bbb);
printf("其他XXXX:\t%d\n", ccc);
return 0;
}