/* Frequency count program for CS 638. Reads standard input and reports: Number of times each character occurs Number of letters (A-Z) and distinct letters Entropy of A-Z distribution Index of coincidence for A-Z distribution Estimate for number of alphabets, based on index of coincidence Eric Bach 10/19/98 */ #include extern double log(); #define LOG2 0.69314718055994530941 #define NUMCHARS 256 #define SPACE ' ' #define TAB '\t' #define NEWLINE '\n' main() { char c; int F[NUMCHARS]; int i; int lettercount, distinctlett; double p, entropy, chi, IC; double n, alphabets; /* Read and echo text, and count characters */ for (i=0;i