Code:
#include <iostream.h>
int main(void)
{
int i,x,m = 0;
int j;
int array[4][2]={{1,2},{2,4},{3,6},{4,8}};
//const int n=8; ??
int counterarray[10];
for(x = 0;x<10;x++){counterarray[x] = 0;}
for(i=0;i<4;i++)
{
for(j=0;j<2;j++)
{
m=array[i][j];
counterarray[m]++;
}
}
for(x = 0;x<10;x++){
cout << "There were " << counterarray[x] << " instances of " << x << endl;
}
return 0;
}
That will count the instances of each number between 0 and 9...you can then play with it to get it to do exactly what you want