Topic: 请教,关于输入A 或 a 输出 Z或z ,B---Y;C--X 之类的问题 |
Print this page |
1.请教,关于输入A 或 a 输出 Z或z ,B---Y;C--X 之类的问题 | Copy to clipboard |
Posted by: 茂珊 Posted on: 2006-04-05 22:15 这是一个要求输入 A 对应 输出 Z 输入B 对应输出 Y 以此类推 ,包括大小写。。。 谁能帮我看一下 关于算法的部分,这个程序可以编译成功,只是算法好像有问题,输入 a 后 点 确定 米有反应阿 !!! 请指教阿
|
2.Re:请教,关于输入A 或 a 输出 Z或z ,B---Y;C--X 之类的问题 [Re: 茂珊] | Copy to clipboard |
Posted by: 茂珊 Posted on: 2006-04-07 22:09 有没有搞错啊 斑竹都不出来帮忙啊!! 高手门帮帮忙啊 |
3.Re:请教,关于输入A 或 a 输出 Z或z ,B---Y;C--X 之类的问题 [Re: 茂珊] | Copy to clipboard |
Posted by: why Posted on: 2006-04-07 23:04 Why should we help if you provide false information? 这个程序可以编译成功 -- I don't believe this, show me if otherwise. Moreover, I don't want to spend my time in guessing what you're trying to do? Explain to us your so called "算法" -- what are those magic numbers 65, 90, 97, 122 -- of course we could check, but why should we waste our time to do so? input.getText() returns a String, so this is an error: c = input.getText(); input.getText() returns empty in the initial pass, so this would throw an exception (anyway, your code won't compile): n=Integer.parseInt(input.getText()); I suggest you to write a command line version before you use an Applet.
|
4.Re:请教,关于输入A 或 a 输出 Z或z ,B---Y;C--X 之类的问题 [Re: why] | Copy to clipboard |
Posted by: 茂珊 Posted on: 2006-04-08 11:56 谢谢WHY 啦 !!! 下次写上注释就是了。。。 不过 c = input.getText(); 不能默认将读入的第一个字符 赋给 c 吗? 还是Java 中就不能读入 字符阿? |
5.Re:请教,关于输入A 或 a 输出 Z或z ,B---Y;C--X 之类的问题 [Re: 茂珊] | Copy to clipboard |
Posted by: why Posted on: 2006-04-08 12:11 茂珊 wrote: I meant these: if(c>97) { ... } else if(n>65&&n<90) what would you use c in the "if" and then "n" in the "else if"? Why should it 能默认将读入的第一个字符? Why? Why don't you read the API doc? And it doesn't mean that "Java 中就不能读入字符". |
6.Re:请教,关于输入A 或 a 输出 Z或z ,B---Y;C--X 之类的问题 [Re: 茂珊] | Copy to clipboard |
Posted by: jeason1914 Posted on: 2006-04-08 12:36
|
7.Re:请教,关于输入A 或 a 输出 Z或z ,B---Y;C--X 之类的问题 [Re: 茂珊] | Copy to clipboard |
Posted by: mliwng Posted on: 2006-04-09 18:33 a的asc码+z的asc码=b的asc码+y的asc码=c的asc码+x的asc码 依次类推,可以很简单的写出的 |
8.Re:请教,关于输入A 或 a 输出 Z或z ,B---Y;C--X 之类的问题 [Re: 茂珊] | Copy to clipboard |
Posted by: jeason1914 Posted on: 2006-04-11 12:46 高斯的搞法 有新意 |
9.Re:请教,关于输入A 或 a 输出 Z或z ,B---Y;C--X 之类的问题 [Re: 茂珊] | Copy to clipboard |
Posted by: jokeyoung Posted on: 2006-06-02 13:28 import java.text.DecimalFormat; import java.io.*; class formartnum { public String formart(String str){ double insert=Double.parseDouble(str); DecimalFormat df=new DecimalFormat("$0,000,000"); return df.format(insert); } } public class formart { public static void main(String[] args) { formartnum f= new formartnum(); BufferedReader bt=new BufferedReader(new InputStreamReader(System.in)); String str=null; try{ System.out.print("请输入数据:"); str=bt.readLine(); }catch(IOException e){ e.printStackTrace(); } //String str="12345678987654"; System.out.println("Message:"+f.formart(str)); } } |
10.Re:请教,关于输入A 或 a 输出 Z或z ,B---Y;C--X 之类的问题 [Re: 茂珊] | Copy to clipboard |
Posted by: dracularking Posted on: 2006-06-12 17:21 import java.awt.event.*; |
11.Re:请教,关于输入A 或 a 输出 Z或z ,B---Y;C--X 之类的问题 [Re: 茂珊] | Copy to clipboard |
Posted by: zz_china Posted on: 2006-06-13 12:44 用if if ('a') output 'z' if ('b') output 'y' if ('c') output 'x' ... |
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 |