标签:实现 hid int tin out class can you height
do { // 循环体 } while (条件判断); 案例: do { System.out.println("还钱"); } while (true);
int i = 0 ; do{ System.out.println(i); i++; } while (i < 10);
// 随机数生成器 Random rd = new Random(); // 创建一个整数随机数 [0,100) int n = rd.nextInt(100); Scanner sc = new Scanner(System.in); boolean flag = true; do { System.out.println("请输入一个0-99之间的数字:"); int you = sc.nextInt(); if(you > n){ System.out.println("猜大了"); } else if( you < n){ System.out.println("猜小了"); } else { System.out.println("猜对了"); flag = false; } } while(flag);
标签:实现 hid int tin out class can you height
原文地址:https://www.cnblogs.com/wenyule/p/12182222.html