如题所述
#include "stdio.h"
#include "conio.h"
int main()
{
char s[100],*p=s;
int num,upper,lower,other;
num=upper=lower=other=0;
printf("Please enter a string:");
gets(s);
for(;*p!='\0';p++)
{
if(*p>='0' && *p<='9') num++;
else if(*p>='a'&&*p<='z') lower++;
else if(*p>='A'&&*p<='Z') upper++;
else other++;
}
printf("num=%d,upper=%d,lower=%d,other=%d",num,upper,lower,other);
getch();
return 0;
}
#include "conio.h"
int main()
{
char s[100],*p=s;
int num,upper,lower,other;
num=upper=lower=other=0;
printf("Please enter a string:");
gets(s);
for(;*p!='\0';p++)
{
if(*p>='0' && *p<='9') num++;
else if(*p>='a'&&*p<='z') lower++;
else if(*p>='A'&&*p<='Z') upper++;
else other++;
}
printf("num=%d,upper=%d,lower=%d,other=%d",num,upper,lower,other);
getch();
return 0;
}
祝你成功!
温馨提示:答案为网友推荐,仅供参考