From 430bc6a3f682d4387ab6ac39c7199d5763e3207d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E6=89=BF=E5=AE=87?= <2508612865@qq.com> Date: Fri, 5 Jun 2020 15:40:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8C=9C=E6=95=B0=E5=AD=97.java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "\347\214\234\346\225\260\345\255\227" | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 "\347\214\234\346\225\260\345\255\227" diff --git "a/\347\214\234\346\225\260\345\255\227" "b/\347\214\234\346\225\260\345\255\227" new file mode 100644 index 0000000..58628be --- /dev/null +++ "b/\347\214\234\346\225\260\345\255\227" @@ -0,0 +1,26 @@ +public static void main(String[] args) throws IOException { + Random a = new Random(); + int num = a.nextInt(100); + System.out.println("请输入一个100以内的整数:"); + for (int i = 0; i <= 9; i++) { + BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); + String str = bf.readLine(); + int shu = Integer.parseInt(str); + if (shu > num) + System.out.println("输入的数大了,输小点的dao!"); + else if (shu < num) + System.out.println("输入的数小了,输大点的!"); + else { + System.out.println("恭喜你,猜对了!"); + if (i <= 2) + System.out.println("你真是个天才!"); + else if (i <= 6) + System.out.println("还将就,你过关了!"); + else if (i <= 8) + System.out.println("但是你还……真笨!"); + else + System.out.println("你和猪没有两样了!"); + break; + } + } + } \ No newline at end of file -- Gitee