[Java] 纯文本查看 复制代码 public class Test01 {
public static void main(String[] args) {
StringBuffer sb = new StringBuffer();
int sum=0;
while(true){
if ((new Scanner(System.in).nextInt())==2) {
return;
} else if ((new Scanner(System.in).nextInt())==1) {
int num = new Random().nextInt(13)+1;
sum +=num;
if (sum<21) {
System.out.print("您手上的牌是:");
sb.append(Integer.toString(num)+" ");
System.out.println(sb);
} else {
System.out.println("点数为:"+sum+",大于21点,游戏结束");
return;
}
}
}
}
}
但愿对你有所帮助…… |