热门
最新
红包
立Flag
投票
同城
我的
发布
m0_54881861
5 年前
truem0_54881861
愤怒的小鸟完成 学会了很多东西但是还需很多东西需要更深度学习一下 做的过程出现了很多BUG 但是在修改过程中也加强了记忆
下一条:
掷骰子找到什么时候两次都掷骰子为1, 并输出次数#小程序public class DiceGame { public static void main(String[] args) { int diceFirst; int diceSecond; int freq=0; do { diceFirst = dice(); diceSecond = dice(); freq+=1; }while(diceFirst!=1 | diceSecond!=1); System.out.println("掷两次骰子的次数:"+freq); } public static int dice() { int result = (int)(Math.random()*6)+1; return result; }}
立即登录