Need a program that gives the output such as this. I am having problems trying t
ID: 3540292 • Letter: N
Question
Need a program that gives the output such as this. I am having problems trying to figure it out in C. Using arrays.
these are the commands:
'C', 'c': Clear the letter counts to 0 in preparation for analyzing new text.
'R', 'r': Read one line of text from the keyboard. Update the letter counts
appropriately, using the ReadText() function.
'P', 'p': Plot the histogram of letter frequencies in all lines of text entered since
the last 'C' command, using the DrawHist() function.
'Q', 'q': Quit exit the program.
Explanation / Answer
it will help u its a running program
#include<stdio.h>
#include<conio.h>
#define TNOCHAR 26
int main(void)
{
int c,i,j;
int character[TNOCHAR];
clrscr();
for(i=0;i<TNOCHAR;++i)
character[i] = 0;
while((c=getchar())!='0')
++character[c-65];
for(i=0;i<TNOCHAR;++i)
{
putchar(i+65);
for(j=0;j<character[i];++j)
putchar('*');
printf(" ");
}
getch();
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.