"stdio.h"
"ctype.h"
"string.h" // used header files
int display(int );
void main( )
{
char st[200];
int i, count;
clrscr( );
printf("Enter the required sentence( Press Ctrl + Z to stop the sentence:");
for(i=0; (st[i]=getchar())!=EOF; i++);
printf("\n\n<---------------------Histogram fequencies--------------->");
printf("\n\n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ..................");
for(i=0, count=0; ; i++)
{
if(st[i]==EOF)
break;
if(isspace(st[i])
count=display(count);
else
count++;
}
count= display(count);
printf("\n<----------------------------End---------------------->");
getch( );
}
int display(int ct)
{
int i;
printf("\n");
for(i=0; i<(ct*2); i++) // (ct*2) is applied becoz 1 alpha= 2 ascii syb
{
putchar(177);
}
printf("(%d)",ct);
return 0;
}
Thursday, June 11, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment