package zuoye;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class zuoye05 {
/**
* @throws IOException
*/
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new FileReader("10.txt"));
String line=br.readLine() ;
int i = Integer.parseInt(line);
if(i==1){
System.out.println("您只要最后一次试用请购买");
}else if(i>0){
System.out.println("您还剩"+i--+"次试用机会");
BufferedWriter bw = new BufferedWriter(new FileWriter("10.txt"));
System.out.println(i);
bw.write(i+""); //write操作的是字符串,转换成字符串才可以转进去;
bw.close();
}
br.close();
}
}
|
|