package hello;

public class 实验四 {

    public static void main(String[] args) {
// TODO Auto-generated method stub
int[][] a ={{9,8,6},{2,3,1},{8,5,2}};
System.out.println("二维数组为:");
for(int i=0;i<a.length;i++)
{
for(int j=0;j<a[i].length;j++)
{
System.out.print(a[i][j]+" ");
}
System.out.println("");
}
int mm,si=0,sj=0,i=0,j=0;
for(i=0;i<a.length;i++)
{
mm=-999999;
si=-1;
sj=-1;
for(j=0;j<a[i].length;j++)
{
if(a[i][j]>mm)
{
mm=a[i][j];
si=i;
sj=j;
}
}
mm=99999;
for(j=0;j<a.length;j++)
{
if(a[si][sj]>a[j][sj])
break;
}
if(j==a.length)
break;
}
System.out.println("找到这个数:");
System.out.println("行标:"+si+" 列标: "+ sj);
System.out.print("数为:"+a[si][sj]); } }

java实验四——找鞍点-LMLPHP

05-11 19:35