“猜数字“游戏,系统随机生成一个[1,100]的数字,由用户输入数字后,计算机提示输入数字“偏大”、“偏小”,并记录猜数次数

import java.util.Scanner;

public class Demo {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int number = (int) (Math.random()*100+1);
		//(0,1)*100=(0,100)+1=[1,100] 
		int count = 0;
		int a;
		do {
			a = in.nextInt();
			if(a>number)
			{
				System.out.println("偏大");
			}
			else if (a

你可能感兴趣的:(Java入门,java,eclipse)