#include "stdio.h"
int main(int argc,char *argv[]){
char a,b,c,ch,i;
printf("Please enter the 10 characters...\n");
for(a=b=c=i=0;i<10;i++){
scanf(" %c",&ch);
if(ch>='a' && ch<='z' || ch>='A' && ch<='Z')
a++;
else if(ch>='0' && ch<='9')
b++;
else
c++;
}
printf("The letter: %d\nThe digit: %d\nThe other: %d\n",a,b,c);
return 0;
}
运行样例:
#include
int main()
{
int alpha,digit,others;
char c;
for(alpha=digit=others=0;(c=getchar())!='\n';)
{
if(c>='a'&&c<='z'||c>='A'&&c<='Z')
alpha++;
else if(c>='0'&&c<='9')
digit++;
else
others++;
}
printf("%d %d %d\n",alpha,digit,others);
return 0;
}
就是觉得没什么胃口大开发开博尔看到你就懂得看到你你复古风就觉得看我怎么咳嗽买啥
吧侧妃hill空