oujianqiang
发贴: 4
积分: 0
|
于 2006-05-21 10:05
已修改,看是不是你想要的结果 import java.io.*; public class t { static String str1[]={"A","B","C","D"}; static String str2[][]={{"*","*","*","*"},{"*","*","*","*"},{"*","*","*","*"},{"*","*","*","*"}}; public static void main(String args[])throws IOException {
int bA; String b1,b2,b3,b4,c1,c2,c3,c4;
//输入A BufferedReader aIn=new BufferedReader(new InputStreamReader(System.in)); System.out.println("A说:"); b1=aIn.readLine(); bA=Integer.parseInt(b1); c1=aIn.readLine(); String g = c1.substring(0,0); hanshu(bA,g);//函数调用
System.out.println("B说:"); b2=aIn.readLine(); bA=Integer.parseInt(b2); c2=aIn.readLine(); String g2 = c2.substring(0,0); hanshu(bA,g2);//函数调用
System.out.println("C说:"); b3=aIn.readLine(); bA=Integer.parseInt(b3); c3=aIn.readLine(); String g3 = c3.substring(0,0); hanshu(bA,g3);//函数调用
System.out.println("D说:"); b4=aIn.readLine(); bA=Integer.parseInt(b4); c4=aIn.readLine(); String g4 = c4.substring(0,0); hanshu(bA,g4);//函数调用
//bA和c的输出 System.out.println(bA); System.out.println();
//数组输出 for(int i=0;i<4;i++) System.out.print(str1[i]+" "); System.out.println("\n"); for(int i=0;i<4;i++) { System.out.println("\n"); for(int j=0;j<4;j++) System.out.print(str2[i][j]+" "); } } //函数 static void hanshu(int x,String y) { String comp; comp=y; int k=0; switch { case 0: for(int i=0;i<4;i++) { if(comp.equals(str1[i])) str1[i]="*"; else { str2[0][k]=str1[i]; k++; } } break; } } }
|