1,读取 试题文件 然后做题算分

        File file1=new File("D:\\file","test.txt");
        try{
            FileReader in1=new FileReader(file1);
            BufferedReader in2=new BufferedReader(in1);
            String s;
            int count=0;
            for(;(s=in2.readLine())!=null;){
                if(!s.startsWith("-")){
                    System.out.println(s);
                }
                else{
                    System.out.print("input your answer: ");
                    s=s.replaceAll("-","");
                    String daan;
                    Scanner scanner1=new Scanner(System.in);
                    daan=scanner1.next();
                    if(s.equals(daan)){
                        count++;
                    }
                }
            }
            System.out.println("point "+count);
        }
        catch(Exception e){
            System.out.println(e.getMessage());
        }
    
View Code

相关文章:

  • 2021-06-30
  • 2021-08-19
  • 2022-02-09
  • 2021-11-01
  • 2022-12-23
  • 2021-05-04
  • 2021-04-05
  • 2022-02-05
猜你喜欢
  • 2021-12-20
  • 2022-02-16
  • 2022-01-20
  • 2021-08-31
  • 2021-07-03
  • 2021-10-21
  • 2021-07-17
相关资源
相似解决方案