Hi,

I want to find number of elements of each type in a double dimensional array

For example

A:{ 1 1 1 1 1
      1 1 1 2
      1 2 2
      1 1 3
      2 3
      1 4
      5                }

So the result should be

P1 =5  P2=0 p3 = 0 p4=0 p5=0
p1=3  p2=1 p3 = 0 p4=0 p5=0
p1=1  p2=2 p3 = 0 p4=0 p5=0
p1=2  p2=0 p3 = 1 p4=0 p5=0
p1=0 p2=1 p3 = 1 p4=0 p5=0
p1=1 p2=0 p3 = 0 p4=1 p5=0
p1=0 p2=0 p3 = 0 p4=0 p5=1

Any advice/idea would be really appreciated.

What have you tried coding thusfar?

its depends, if the numbers is between 0 -9 you can create an array of counters that will update in a loop for etch row and than will be printed, and if the numbers interval is un limited it will be more tricky , you will have to allocate new counter for each new number

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.