Question: The program has to be written in C programming Language Question: We have a bunch of items categorized by the letters of english alphabet. We

The program has to be written in C programming Language

Question: We have a bunch of items categorized by the letters of english alphabet. We receive different amounts of them over time and we want to keep track of how much of each lettered item we have received. Maintain a running total of the number of a, b, c, ..., x, y, z items we have received.

Example output

The program will read from the terminal using scanf or fgets a single character descriptor---a key---followed by a count of the number of oberservations of that key. Then at the end of the program when the user quits or indicates they want to quit (by typing X) or mistypes something, the total of sum of each lettered item is printed if their sum is greater than 0.

The summary will be like

a - 1 b - 1 

if the user typed following input: a 1 b 1. Only positive counts will be displayed.

$ ./question2 Welcome to variable counter! Please record your counts! Type X to end. Input character variable a-z: a Input count variable a-z: 10 Input character variable a-z: b Input count variable a-z: 10 Input character variable a-z: c Input count variable a-z: 10 Input character variable a-z: X a - 10 b - 10 c - 10 $ ./question2 Welcome to variable counter! Please record your counts! Type X to end. Input character variable a-z: a Input count variable a-z: 7 Input character variable a-z: a Input count variable a-z: 8 Input character variable a-z: a Input count variable a-z: 9 Input character variable a-z: b 99 Input count variable a-z: Input character variable a-z: X a - 24 b - 99 $ ./question2 Welcome to variable counter! Please record your counts! Type X to end. Input character variable a-z: a Input count variable a-z: 1 Input character variable a-z: b Input count variable a-z: 2 Input character variable a-z: c Input count variable a-z: 3 Input character variable a-z: d Input count variable a-z: 4 Input character variable a-z: z Input count variable a-z: 99 Input character variable a-z: X a - 1 b - 2 c - 3 d - 4 z - 99 $ ./question2 Welcome to variable counter! Please record your counts! Type X to end. Input character variable a-z: X $ ./question2 Welcome to variable counter! Please record your counts! Type X to end. Input character variable a-z: aaaaaaaaaaa $ ./question2 Welcome to variable counter! Please record your counts! Type X to end. Input character variable a-z: what $ ./question2 Welcome to variable counter! Please record your counts! Type X to end. Input character variable a-z: a Input count variable a-z: what $ ./question2 Welcome to variable counter! Please record your counts! Type X to end. Input character variable a-z: a Input count variable a-z: 10 Input character variable a-z: what a - 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!