#include
#include
#define MAX 256
int main(int argc, char *argv[])
{
int n, m, i, j, k, l, minn, maxx, flag ;
int a[MAX][MAX];
while(1)
{
printf("请输入矩阵的行列数:");
scanf("%d %d",&n,&m);
printf("请输入与行列数相符的矩阵:\n");
for( i =0 ;i < n ;i++)
for( j =0 ;j < m; j++)
scanf("%d",&a[i][j]);
flag = 0;
printf("马鞍点输出:\n");
for( i = 0; i < n ;i++)
{
for( j = 0; j < m; j++)
{
minn = a[i][j];
for( k = 0 ;k < m; k++)
{
if( minn > a[i][k])
break;
}
if( k == m)
{
maxx = a[i][j];
for( l = 0; l < n; l++)
{
if( maxx < a[l][j])
break;
}
if( l == n)
{
printf("第%d行,第%d列马鞍点是:%d\n",i + 1, j + 1,a[i][j]);
flag = 1;
}
}
}
}
if( flag == 0)
printf("此矩阵没有马鞍点");
printf("\n");
}
return EXIT_SUCCESS;
}
阅读(1146) | 评论(0) | 转发(0) |