#include "header.h" int main(){ int num[256], i, current; unsigned char ch; char fname[100]; FILE *fp; time_t t1, t2; printf("Enter the name of the file:"); scanf("%s",fname); fp=fopen(fname, "r");// Read in an existing file. time(&t1);// Start timer. for(i=0;i<256;i++) num[i]=0;// Initialize the number of each character to be 0. while((current=fgetc(fp))!=EOF){ ch = current; num[ch]+=1; };// When computer gets a character, add one to its number. time(&t2); //Stop timer. for(i=32;i<127;i++) if(num[i]>0) printf("%c:%d\n",i, num[i]);// Print out each character and its number. printf("Use %d seconds.\n",(int)(t2-t1)); fclose(fp); // Close the file. return 0; }