#include <stdio.h>
int validate(int [][],int,int,int,int);
int main(int argc, int *argv[])
{
int a[3][4] = {{7,6,3,40},{8,3,20,34},{40,3,29,60}};
int i,j,k;
int bol = 0;
for (i = 0; i < 3; i++)
{
for (j = 0; j < 4; j++)
{
if (validate(a,3,4,i,j))
{
bol = 1;
printf("the andian in row %d ,col %d , value is %d \n",i,j,a[i][j]);
}
}
}
if (0 == bol)
{
printf("not andian!\n");
}
system("pause");
return 0;
}
int validate(int data[3][4],int row, int col,int row_value,int col_value)
{
int b,i,j;
b = data[row_value][col_value];
if (row_value > row || col_value > col)
{
return 0;
}
for (i = 0; i < row; i++)
{
if (b > data[i][col_value])
{
return 0;
}
}
for (j = 0; j < col; j++)
{
if (b < data[row_value][j])
{
return 0;
}
}
return 1;
}
|