猜数字
学过语言的人都知道,猜数字这个游戏在我们编程路上是一个很经典的例子,所以在这里我也将Java中的猜数字游戏记录下来。
import java.util.Scanner;
import java.util.Scanner;
public class Demo07 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int number = (int) (Math.random() * 100); // 产生随机数
int guess;// 用户猜的数字
int count = 0;
System.out.println("来猜一个100以内的数字吧!");
System.out.println("请输入这个数字:");</