Question: Write a program in C++ that reads in a list of integers into and array with base type int. Provide the facility to either read

Write a program in C++ that reads in a list of integers into and array with base type int. Provide the facility to either read this array from the keyboard or from a file, at the user's option. If the user chooses file input, the program should request a file name. You may assume that there are fewer than 50 entries in the array. Your program determines how many entries there are. The output is to be a two_column list. The first column is a list of the distinct array elements; the second column is the count of the number of occurrences of each element. The list should be sorted on entries n the first column, largest to smallest. Functions should be used to read in the data, make a unique array, sort the values in descending order(using swap), make counters for each unique value, and print out unique values and their counts. For example: With input like -12 3 -12 4 1 1 -12 1 -1 1 2 3 4 2 3 -11.

Output should be:

N Count

4 2

3 3

2 2

1 4

-1 1

-12 4

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!