#include<stdio.h>
#include<ctype.h>
int main(void)
{
int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
int blank=0;
int line_break=0;
char ch;
a=b=c=d=e=f=g=h=i=j=k=l=m=n=o=p=q=r=s=t=u=v=w=x=y=z=0;
printf("input a string chars: \n");
while((ch=getchar())!='#')
{
if(ch=='a')
a++;
else if(ch=='b')
b++;
else if(ch=='c')
c++;
else if(ch=='d')
d++;
else if(ch=='e')
e++;
else if(ch=='f')
f++;
else if(ch=='g')
g++;
else if(ch=='h')
h++;
else if(ch=='i')
i++;
else if(ch=='j')
j++;
else if(ch=='k')
k++;
else if(ch=='l')
l++;
else if(ch=='m')
m++;
else if(ch=='n')
n++;
else if(ch=='o')
o++;
else if(ch=='p')
p++;
else if(ch=='q')
q++;
else if(ch=='r')
r++;
else if(ch=='s')
s++;
else if(ch=='t')
t++;
else if(ch=='u')
u++;
else if(ch=='v')
v++;
else if(ch=='w')
w++;
else if(ch=='x')
x++;
else if(ch=='y')
y++;
else if(ch=='z')
z++;
else if(ch==' ')
blank++;
else if(ch=='\n')
line_break++;
}
printf("letter a=%d \n",a);
printf("letter b=%d \n",b);
printf("letter c=%d \n",c);
printf("letter d=%d \n",d);
printf("letter e=%d \n",e);
printf("letter f=%d \n",f);
printf("letter g=%d \n",g);
printf("letter h=%d \n",h);
printf("letter i=%d \n",i);
printf("letter j=%d \n",j);
printf("letter k=%d \n",k);
printf("letter l=%d \n",l);
printf("letter m=%d \n",m);
printf("letter n=%d \n",n);
printf("letter o=%d \n",o);
printf("letter p=%d \n",p);
printf("letter q=%d \n",q);
printf("letter r=%d \n",r);
printf("letter s=%d \n",s);
printf("letter t=%d \n",t);
printf("letter u=%d \n",u);
printf("letter v=%d \n",v);
printf("letter w=%d \n",w);
printf("letter x=%d \n",x);
printf("letter y=%d \n",y);
printf("letter z=%d \n",z);
printf("blank=%d \n",blank);
printf("line_blank=%d \n",line_break);
getchar();
getchar();
return(0);
}
这个程序的作用是把用户输入的字符统计,按#退出