java 猜数字
import java.util.Scanner;
import java.util.Random;
public class Hellword {
public static void main(String[] args) {
//猜数字
Random r = new Random();
int num = r.nextInt(100)+1;
while (true){
Scanner sc = new Scanner(System.in);
System.out.println("请输入你猜的数字:");
int gessNum = sc.nextInt();
if (gessNum>num){
System.out.println("你猜的数字"+gessNum+"太大了。");
}else if (gessNum<num){
System.out.println("你猜的数字"+gessNum+"太小了。");
}else {
System.out.println("你猜中了。");
break;
}
}