不想改,
给楼主个新的,
以前写的,
改了一点,
凑合能用,
具体就是输入文件名后(要加全路径),
就会在此文件的文件夹下生成一个文件,
里面放着结果
import .*;
import .*;
public class acm_problem {
private String fileName;
private File file;
public acm_problem() {
getInputFileName();
checkFile();
manageData();
}
public void getInputFileName(){
("请输入要进行计算的文件路径:");
Scanner s = new Scanner(new BufferedInputStream());
fileName = ();
(fileName);
();
}
public void checkFile(){
file = new File(fileName);
if(!())
{
("文件不存在!退出...");
(0);
}
if(!())
{
("不能处理文件!退出...");
(0);
}
}
public void manageData(){
("处理数据中...");
try{
BufferedReader br = new BufferedReader(new FileReader(file));
String s1 = ();
s1 = s1+"";
//(s1);
File file1 = new File(s1);
BufferedWriter bw = new BufferedWriter(
new FileWriter(file1));
String s = null;
while( ( s = ())!= null){
(((int)(()/2)));
();
}
();
();
("数据处理完毕");
}catch(Exception e){
();
}
}
}