Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区 » 编程/算法/API  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:JAVA 魂牵梦绕的一道难题 [Re:jasonhero]
qingzhipan027





发贴: 1
积分: 0
于 2006-05-22 11:49 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我改了下,语法上没什么问题了,可是好像执行不了……
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;

BufferedReader aIn=new BufferedReader(new InputStreamReader(System.in));

//输入A
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(x)
{
case 0:
for(int i=0;i<4;i++)
{
if(comp.equals(str1[i]))
str2[k][i]="*";
else
str2[k][i]=str1[i];
}
k++;
break;
case 1:
for(int i=0;i<4;i++)
{
if(comp.equals(str1[i]))
str2[k][i]=str1[i];
else
str2[k][i]="*";
}
k++;
break;
}
}
}


why edited on 2006-05-22 12:32


话题树型展开
人气 标题 作者 字数 发贴时间
8818 JAVA 魂牵梦绕的一道难题 jasonhero 1847 2006-05-17 13:09
7597 Re:JAVA 魂牵梦绕的一道难题 java学生 6 2006-05-17 21:21
7347 Re:JAVA 魂牵梦绕的一道难题 king431 20 2006-05-19 21:43
7285 Re:JAVA 魂牵梦绕的一道难题 oujianqiang 1487 2006-05-21 10:05
7433 Re:JAVA 魂牵梦绕的一道难题 haiboxiaozi 15 2006-05-21 15:16
7829 Re:JAVA 魂牵梦绕的一道难题 qingzhipan027 1602 2006-05-22 11:49

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923