Question: Given a 2D array that contains random upper case letters ('A' - 'Z'), write a piece of code that will count and display how many

Given a 2D array that contains random upper case letters ('A' - 'Z'), write a piece of code that will count and display how many times each character appeared in the array. The letters displayed in the output must be in reverse alphabetical order. You can assume that the array is called letters and is already declared and that it has n rows and m columns. You can declare any additional variables you need, but you do not need to worry about writing a full program (i.e., with include headers or a main function etc) or reading input from the user. You just need to provide the code that performs the specified functionality and the syntax of the piece of code you write must be correct. Your program must use an array to keep track of the letter counts.

An example output of your program would be:

Z did not appear
Y appeared 1 times
X appeared 5 times
W appeared 10 times
V did not appear
U appeared 4 times
T appeared 2 times
... //will have the rest of the alphabet
C appeared 1 times
B did not appear
A appeared 2 times

B appeared 3 times

F appeared 8 times

Z appeared 4 times

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!