#include <stdio.h>
int main (int arge,char *argv[])
{
Char ch;
int alp=0,num=0,oth=0,len,alp_start,num_start,oth_start,i;
while ((Ch=getchar ())!=-1)
{
if (ch>= ' 0 ' &&ch<= ' 9 ') num++;
else if ((ch>= ' a ' &&ch<= ' z ') | | (ch>= ' A ' &&ch<= ' Z '))
alp++;
Else
oth++;
}
Len=alp>num? (alp>oth?alp:oth):(num>oth?num:oth);
Alp_start=len+1-alp;
Num_start=len+1-num;
Oth_start=len+1-oth;
printf ("ALP:%d num:%d oth:%d\n", Alp,num,oth);
printf ("%5s%8s%5s%8s%5s\n", "ALP", "", "num", "", "oth");
for (i=0;i<len+1;i++)
{
if (I==alp_start)
printf ("%3d%2s", ALP, "");
else if (I>alp_start)
printf ("* * * *");
Else
printf ("");
printf ("%8s", "" ");
if (I==num_start)
printf ("%3d%2s", num, "");
else if (I>num_start)
printf ("* * * *");
Else
printf ("");
printf ("%8s", "" ");
if (I==oth_start)
printf ("%3d%2s", Oth, "");
else if (I>oth_start)
printf ("* * * *");
Else
printf ("");
printf ("%8s", "" ");
printf ("\ n");
}
return 0;
}
The C language enters a string that counts the number of letters, numbers, and other characters and outputs them in a histogram.