day07-常用类_Random_猜数字游戏
This commit is contained in:
14
day07/src/com/inmind/random02/Demo06.java
Normal file
14
day07/src/com/inmind/random02/Demo06.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.inmind.random02;
|
||||||
|
/*
|
||||||
|
常用类_Random_猜数字游戏(1~100)
|
||||||
|
分析:
|
||||||
|
1.使用random类获取一个随机值
|
||||||
|
2.使用scanner输入你所猜的值
|
||||||
|
a.将输入的猜的值跟随机数做比较,如果猜的值大了,需要提示猜的值:33大了
|
||||||
|
b.将输入的猜的值跟随机数做比较,如果猜的值小了,需要提示猜的值:33小了
|
||||||
|
c.将输入的猜的值跟随机数做比较,如果猜的值一致,需要提示正确,并结束游戏
|
||||||
|
3.注意:如果用户猜不对,程序永远不结束(死循环)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Demo06 {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user