How can i display unique number in a matrice . For example the matrice : 16483
23870
14509
26901
And this display :

Nr: 0 -> 3
1 -> 3
2 -> 2
3 -> 2
4 -> 2
5 -> 1
6 -> 1
......... . Plesae helo me

Homework? If yes: show us what you've done.

Is this a training for 2d-arrays? Because I can think up a few much more 'C++ ways' to solve this problem..

Please help me because this is for an exam that a need here in my job

We only help if you show some effort yourself.

commented: why you can hep me +0
#include<iostream.h>
#include<conio.h>

int main()
{
   int i,j=0,k,ch;
   int Matrice[4][5]={1,6,4,8,3,2,3,8,7,0,1,4,5,0,9,2,6,9,0,1};
   for(ch=0;ch<10;ch++)
   {
      for(i=0;i<4;i++)
      {
                      for(k=0;k<5;k++)
                      {
                                      if(ch==Matrice[i][k])
                                      j++;
                                      }
                      }
                      if(j>0)
                      cout<<ch<<" -> "<<j<<endl;
                      j=0;
      }
   system("PAUSE");
   return 0;
}

>this is for an exam that a need here in my job
Your job? Dare I ask what kind of job gives exams that look a lot like elementary CS homework? You're clearly not a professional developer, judging by your code and complete inability to solve this simple problem.

I solved in php using an associative array. and the function array_key_exist in php. It was too simple.

$matrice=array(array(1, 2 ,3 ) , array(2,1 4) .....
$a=array() // associative array
for($i=0 ; $i<10; $i++)
{
  for($j=0 ; $j<10; $j++)
 {
   if array_key_exist($matrice[$i][$j],$matrice)
   { $a[$matrice[$i][$j]]++ ; }
   else 
   $a[$matrice[$i][$j]]=1;
}
}

>> I solved in php

So why did you post in the C++ forum? Now this thread makes even less sense then it already initially did..

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.