Menu

(Solved) : Using C Programming Language Built Function Getchar 1 Counts Program Count Occurrences Alp Q43992285 . . .

Using C programming language and the built in function ofgetchar():

1. Counts

Your program should count occurrences of alphabetical, Englishletters a through z, case insensitive. It should ignore all othercharacters except for the EOF character which, when encountered,should display the counts of only the alphabetical characters withat least one occurrence. The expected format of this output is, foreach character and count on its own line:

2.2 – Percents

After outputing character counts, your program should output theeach character’s percentage of the alphabetical charactersencountered. For example, in the example input “Cackalack!” therewere were 9 alphabetical characters and 3 of them were the letterc, so c’s percentage was 33.3%. The expected format of this outputis, for each character and percentage on its own line, eachpercentage should have one digit of significance and be followed bythe % symbol:

3. Frequency Bar Chart

The final challenge of this lab is to produce a vertical barchart of relative frequencies, as shown in the prior exampleoutput. It should be scaled such that the tallest bar in your chartis always 10 lines tall. Use the vertical bar character | whendrawing the bars. When the height of a bar has a decimal component,you should always truncate it (always round down). Unlike theprevious two parts, there should be an entry for every alphabeticalcharacter to form the x-axis of the chart as shown in the previousexample, even if it has no bar.

SAMPLE INPUT:

$ echo “Cackalack!” | ./a.out

SAMPLE OUTPUT (MUST MATCH EXACTLY):

Counts: a: 3 c: 3 k: 2 1: 1 Percents: a: 33.3% c: 33.3% k: 22.2% 1: 11.1% Chart: | | abcdefghijklmnopqrstuvwxyz

Counts: a: 3 c: 3 k: 2 1: 1 Percents: a: 33.3% c: 33.3% k: 22.2% 1: 11.1% Chart: | | abcdefghijklmnopqrstuvwxyz Show transcribed image text Counts: a: 3 c: 3 k: 2 1: 1 Percents: a: 33.3% c: 33.3% k: 22.2% 1: 11.1% Chart: | | abcdefghijklmnopqrstuvwxyz

Expert Answer


Answer to Using C programming language and the built in function of getchar(): 1. Counts Your program should count occurrences of …

OR