主要涉及知识点为io流以及逻辑思考,没有标准答案,仅供参考
诸位可以自行复制到IDEA中运行修改并优化
package GuessGame;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class Number {
public static void main(String[] args) {
boolean b = true;
int c = 0;
String fileName = System.getProperty("user.dir") + "\\score.txt";
while (b) {
try {
System.out.println("**************************");
System.out.println("*\t猜 数 字 小 游 戏\t *");
System.out.println("*\t1、开 始 游 戏\t *");
System.out.println("*\t2、查 看 英 雄 榜\t *");
System.out.println("*\t3、游 戏 说 明\t *");
System.out.println("*\t0、退 出 游 戏\t *");
System.out.println("**************************");
System.out.println("请选择:");
Scanner scanner = new Scanner(System.in);
c = scanner.nextInt();
switch (c) {
case 1:
long l = Math.round((Math.random() * 100));
//过滤0