mirror of
https://github.com/This-weiyuqing/javaAutoScore.git
synced 2026-10-17 18:55:31 +08:00
Add files via upload
This commit is contained in:
1 file changed
+43
@@ -0,0 +1,43 @@
|
||||
# ~~解决每个题文件~~
|
||||
|
||||
# ~~解决答案文件~~
|
||||
|
||||
# ~~解决文件读取问题~~
|
||||
|
||||
显然一个一个文件写读取是不可能的
|
||||
|
||||
通过循环
|
||||
|
||||
# ~~设计对话框~~
|
||||
|
||||
整体窗口 上部分题 下部分选择按钮 计划不做自己选题,点击按钮自动下一题
|
||||
|
||||
# 四个按钮
|
||||
|
||||
四个按钮读取答案文件返回值的字符与学生选择的做比较,相等加分,不相等不加分,
|
||||
|
||||
# 可以考虑添加计时功能,总计时长10分钟,超时按0分计算。
|
||||
|
||||

|
||||
|
||||
# `框体使用网格组布局管理器`
|
||||
|
||||
新建设置
|
||||
|
||||
```java
|
||||
public static void readFile(int q) {
|
||||
File pathname = question(q);
|
||||
try (FileReader reader = new FileReader(pathname);
|
||||
BufferedReader br = new BufferedReader(reader) // 建立一个对象,它把文件内容转成计算机能读懂的语言
|
||||
) {
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
// 一次读入一行数据
|
||||
System.out.println(line);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}return line;
|
||||
}
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user