Checking input data solution

Here is my problem.I am making an array to ask input from the user as shown in example below.I need to make sure that out of all the array that been input, there is at least one is equal with another for example array[1][2]=4 is equal to array[3][0]=4. So how do i make the code such that it will check all the input and determine whether any of the array is equal with one another or not... It can be more than 1 same array but must not less than 1.


1
2
3
4
5
6
7
8
9
10
11
for(row=0;row<4;row++)
	{

		printf("Enter Row %d:",row+1);

		for(col=0;col<4;col++)
		{
		scanf("%d",&num[row][col]);

		}
	}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
bool found_pair = false;
int tmp;
for(int i=0; i<(row*col)/sizeof(num[0]); i++)
{
   tmp = num[i];
   for(int j=i; j<(row*col)/sizeof(num[0]); j++)
   {
      if(num[j] == tmp)
      {
         found_pair = true;
         break;
      }
   }
   if(foun_pair)
      break;
}

quite bad code (especial the two breaks :\) but it works and the concept itself is good, i think
Topic archived. No new replies allowed.