import java.util.Random; public class jana1 { public static void main(String[]args){ int target, x; Scanner sc = new Scanner(System.in); Random random =new Random(); target = random.nextInt( bound ); while (true){ System.out.print("输入你猜测的数"); x = sc.nextInt(); if (x>target){ System.out.println("朋友,你猜高了"); } else if (x<target){ System.out.println("朋友,你猜低了"); }else { break; } } System.out.println("猜对了"); } }
猜数小游戏
于 2022-04-14 09:01:00 首次发布