I thought I did perfectly but I want the histogram to like the graph:
#include <iostream>
#include <cstdio>
#include <ctype.h>
#include <cstdlib>
using namespace std;
int main(int argc, char** argv)
{
int i, cols ;
cols = 50 ;
int line = 60 ;
int c; int max = 0 ;
static int count [26];
for (int i =0; i<26; i++)
count [i] = 0 ;
c=cin.get();
while (!cin.eof())
{
if (isalpha(c))
{
c = tolower(c);
count[ c- 'a'] ++;
}
c=cin.get();
}
for (int i = 0; i < 26; i++)
if (max < count [i])
max = count [i];
for (int i = 0; i < 26; i++)
printf( "count [%c] : %7d/n", i + 'a', count[i]);
for (int i = 0; i < 26; i++)
{
printf( "%7d %c", count[i], 'a' + 1);
int limit = ((count[i]*cols )/ max);
for (int x = 0; x< limit; x++ )
cout.put ('*');
cout.put ('\n');
} //ends loop
int LINES = 48;
for (line=LINES; line>0;line--)
{
int threshold = (line*max)/LINES;
for (int i = 0; i < 26; i++)
{
if (count[i]>threshold)
cout.put('#');
else
cout.put(' ');
}
cout.put('\n');
}
}