On Wed, 2005-05-18 at 16:44 +1200, Zane Gilmore wrote:
> John Carter wrote:
> <snip>
> >
> > Simple enough?
>
> I would argue that that is too simple.
Agreed. Below is the C code to do the task, and that is trivial.
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
int main(int argc, char *argv[])
{
int chars[128] = {0};
char c = '\0';
while((c = getc(stdin)) != EOF)
chars[(int)c]++;
c = '\0';
while(c <= '~')
{
if (isalnum(c))
printf("%c: %d\n", c, chars[(int)c]);
c++;
}
exit(0);
}
--
Michael JasonSmith http://www.ldots.org/