使用do-while循环验证来自用户的输入
//时 代 J a v a - nowjava.com 提 供 import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int bank = 1000; // assume the user has $1,000 int bet; // the bet entered by the user System.out.println("You can bet between 1 and " + bank); do { System.out.print("Enter your bet: "); bet = sc.nextInt(); } while (