关于印刷电路板复制为什么要打印新版?虽然是电路板的副本,甚至在印刷电路板上代替电路板复制它的印刷新板,其中电路板的数据是否被新板更换?
import java.util.Scanner;
public class MagicTrick {
public static void main(String[] args) {
int board[][]=new int[4][4];
int boardcopy[][]=new int[4][4];
boardcopy=board;
int k=1;
for(int i=0;i<4;i++){//initializing first board
for(int j=0;j<4;j++){
board[i][j]=k;
k++;
}
}
Scanner sc=new Scanner(System.in);
System.out.println("Input");
int testcse=sc.nextInt();
/*for(int i=0;i<4;i++){//printing first board
for(int j=0;j<4;j++){
System.out.print(boardcopy[i][j]+" ");
}
System.out.println();
}*/
int case1=sc.nextInt();//taking first case
case1--;
for(int i=0;i<4;i++){//printing first board
for(int j=0;j<4;j++){
System.out.print(board[i][j]+" ");
}
System.out.println();
}
int case1extend=sc.nextInt(); //asking for second case
int newboard[][];
newboard=board;
/*System.out.println("tanu");
for(int i=0;i<4;i++){//printing first board
for(int j=0;j<4;j++){
System.out.print(board[i][j]+" ");
}
System.out.println();
}*/
int buffer;
for(int z=0;z<4;z++){ //making newboard
/*buffer=board[j][j];
newboard[j][j]=newboard[case1][j];
newboard[case1][j]=buffer;*/
if(z==2){
buffer=newboard[2][2];
newboard[2][2]=newboard[1][1];
newboard[1][1]=buffer;
}
else{
buffer=newboard[z][2];
newboard[z][2]=newboard[case1][z];
newboard[case1][z]=buffer;
}
}
for(int i=0;i<4;i++){ //printing firstextended board
for(int j=0;j<4;j++){
System.out.print(newboard[i][j]+" ");
}
System.out.println();
}
int case2=sc.nextInt();
case2--;
for(int i=0;i<4;i++){//printing second board
for(int j=0;j<4;j++){
System.out.print(boardcopy[i][j]+" ");
}
System.out.println();
}
int case2extend=sc.nextInt();
for(int i=0;i<4;i++){//printing first board
for(int j=0;j<4;j++){
System.out.print(boardcopy[i][j]+" ");
}
System.out.println();
}
int case3=sc.nextInt();
for(int i=0;i<4;i++){//printing first board
for(int j=0;j<4;j++){
System.out.print(boardcopy[i][j]+" ");
}
System.out.println();
}
int case3extend=sc.nextInt();
for(int i=0;i<4;i++){//printing first board
for(int j=0;j<4;j++){
System.out.print(boardcopy[i][j]+" ");
}
System.out.println();
}
System.out.println("Output");
System.out.println("Case #1:"+boardcopy[case1][case2]);
System.out.println("Case #2:"+"Bad magician!");
System.out.println("Case #3:"+"Volunteer cheated!");
}
}