由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - do-while question
相关主题
java 随机数 nextInt(int n)的问题Java basic concept(3)
Java 8 stream 可以 代替 do while loop吗?怎么写弱问:C的for/while循环能在括号里面continue吗?
java有支持vibration的api吗?Breaking News, Jobs RESIGNED
netbeans 4.0 is very goodBreaking news: debt ceiling successfully raised!!!
anyone saw this on code?Good Breaking News
Web service needed问一个简单的C编程问题
刚刚提交了一个bug Re: 笨问题续:TOMCAT不能按时close- update
System.exit(0)问题F1学生买房有没有8000块钱的Tax credit?
相关话题的讨论汇总
话题: break话题: case话题: success话题: 61433话题: int
进入Java版参与讨论
1 (共1页)
x****a
发帖数: 1229
1
int x = 6; int success = 0;
do {
switch(x) {
case 0: System.out.print("0"); x += 5; break;
case 1: System.out.print("1"); x += 3; break;
case 2: System.out.print("2"); x += 1; break;
case 3: System.out.print("3"); success++; break;
case 4: System.out.print("4"); x -= 1; break;
case 5: System.out.print("5"); x -= 4; break;
case 6: System.out.print("6"); x -= 5; break;
}
} while ((x != 3) || (success < 2));
what is the output?
61433 or 6143?
g**e
发帖数: 6127
2
61433呀

【在 x****a 的大作中提到】
: int x = 6; int success = 0;
: do {
: switch(x) {
: case 0: System.out.print("0"); x += 5; break;
: case 1: System.out.print("1"); x += 3; break;
: case 2: System.out.print("2"); x += 1; break;
: case 3: System.out.print("3"); success++; break;
: case 4: System.out.print("4"); x -= 1; break;
: case 5: System.out.print("5"); x -= 4; break;
: case 6: System.out.print("6"); x -= 5; break;

x****a
发帖数: 1229
3
I choose this answer and it turns wrong.

【在 g**e 的大作中提到】
: 61433呀
g**e
发帖数: 6127
4
跑了一下就是输出这个

【在 x****a 的大作中提到】
: I choose this answer and it turns wrong.
x****a
发帖数: 1229
5
yes, I complied, too. not sure if something is wrong.
x*****p
发帖数: 1707
6
61433
The answer from what you see is wrong.
1 (共1页)
进入Java版参与讨论
相关主题
F1学生买房有没有8000块钱的Tax credit?anyone saw this on code?
resident alien or nonresident alien?Web service needed
关于国际学生报税身份1040nr还是1040刚刚提交了一个bug Re: 笨问题续:TOMCAT
怎么IRS大叔说F1待满5年也不一定算residentSystem.exit(0)问题
java 随机数 nextInt(int n)的问题Java basic concept(3)
Java 8 stream 可以 代替 do while loop吗?怎么写弱问:C的for/while循环能在括号里面continue吗?
java有支持vibration的api吗?Breaking News, Jobs RESIGNED
netbeans 4.0 is very goodBreaking news: debt ceiling successfully raised!!!
相关话题的讨论汇总
话题: break话题: case话题: success话题: 61433话题: int