Answer:
C code
Step-by-step explanation:
#include <stdio.h>
void histrogram(int counters[])
{
int i,j;
int count;
for(i=0;i<26;i++)
{
count=counters[i];
printf("%c ",i+97);
for(j=0;j<count;j++)
{
printf("="); //= is used
}
printf("\\");
}
}
int main()
{
FILE* fp;
int i;
int arr[26];
char c;
int val;
// Open the file
fp = fopen("story.txt", "r");
if (fp == NULL) {
printf("Could not open file ");
return 0;
}
else
{
for(i=0;i<26;i++)
arr[i]=0;
for (c = getc(fp); c != EOF; c = getc(fp))
{
if(c>='a' && c<='z')
{
val = c-97;
//printf("%d ",val);
arr[val]++;
}
}
histrogram(arr);
}
}