Write a program that reads in an array of type int. Provide facility to either read
this array from the key board 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 in the first column, largest to smallest.

For the array

-12 3 -12 4 1 1 -12 1 -1 1 2 3 4 2 3 -12

the output should be

N Count

4 2

3 3

2 2

1 4

-1 1

-12 4

dont know where to even begin!
Well, then you'll have to help us out there too.

>Write a program that reads in an array of type int.

Do you know what an array is?
Do you know how to create an array of int?

>Provide facility to either read this array from the key board or from a file, at the user's option.

Do you know how to read integers from the keyboard?
Do you know how to read integers from a file?
Do you know how to query the user?

>If the user chooses file input, the program should request a file name.

Do you know how to read a string from the keyboard?

>You may assume that there are fewer than 50 entries in the array.

Do you know how to use this hint?

>Your program determines how many entries there are.

Do you know how to use this hint?

>The output is to be a two-column list.
>The first column is a list of the distinct array elements;

Do you know what this means?

>the second column is the count of the number of occurrences of each element.

Do you know what this means?

>The list should be sorted on entries in the first column, largest to smallest.

Do you know how to sort?

sounds to me like you have instructions there which detail every single thing your application needs to do and the exact order it needs to do them in.

If that's not enough to create a small program I wonder how you're ever going to write something large based on requirements no more precise than "make a program that does XXX"...

can someone give me this programming code?

can someone give me this programming code?

no.

its not as hard as you think
just give it a shot
as long as you know how to use scanf fscanf fopen printf your
are good

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.