當前位置:編程學習大全網 - 編程軟體 - Xi同學編程

Xi同學編程

哈哈,我以前做過。

公共級國際象棋{

/**

* @param args

*/

公共靜態void main(String[] args) {

int width = 3;

boolean isqual = false

int[][]point = new int[width][width];

for(int I = 0;我& lt寬度;i++){

for(int j = 0;j & lt寬度;j++){

point[I][j]=(int)(math . random()* 2);

system . out . print(point[I][j]+" ");

}

system . out . println();

}

for(int I = 0;我& lt寬度;i++){

for(int j = 0;j & lt寬度;j++){

if(point[i][0] == point[i][j]){

isqual = true

}否則{

isqual = false

打破;

}

}

if(isqual)

system . out . println(" line "+(I+1)+" is all "+point[I][0]);

}

for(int j = 0;j & lt寬度;j++){

for(int I = 0;我& lt寬度;i++){

if(point[0][j] == point[i][j]){

isqual = true

}否則{

isqual = false

打破;

}

}

if(isqual)

system . out . println(" column "+(j+1)+" is all "+point[0][j]);

}

for(int I = 0;我& lt寬度;i++){

if(point[0][0] == point[i][i]){

isqual = true

}否則{

isqual = false

打破;

}

}

if(isqual)

system . out . println(" all from top left to bottom left "+point[0][0]);

for(int I = 0;我& lt寬度;i++){

if(point[width-1][0]= = point[I][width-I-1]){

isqual = true

}否則{

isqual = false

打破;

}

}

if(isqual)

system . out . println(" all from bottom left to top right "+point[0][0]);

}

}

  • 上一篇:為什麽甲骨文公司是美國最老的?
  • 下一篇:java語言不區分大小寫
  • copyright 2024編程學習大全網