标签:
#include<stdio.h>
int main(int argc, char * argv[])
{
char *p;
char str[100];
int n=10;
int len;
int count_upper=0;
int count_lower=0;
int count_num=0;
printf("input string:\n");
p=(char*)malloc(sizeof(char)*n);
gets(str);
len=strlen(str)+1;
if(len>n)
{
p=(char*)realloc(p,sizeof(char)*len);
}
strcat(p,str);
printf("%s\n",p);
while(*p!=NULL)
{
if(*p>=65 && *p<=90)
{
count_upper+=1;
}
if(*p>=97 && *p<=122)
{
count_lower+=1;
}
*p++;
}
printf("%d\n",count_lower);
printf("%d\n",count_upper);
}
标签:
原文地址:http://www.cnblogs.com/miry/p/5570683.html