Developpement/23DEV1.1/TPS2/TP01/FluxDeCaracteres/Questionnaire.java

29 lines
965 B
Java
Raw Permalink Normal View History

2024-12-09 11:53:11 +01:00
import java.io.*;
public class Questionnaire
{
public static void main(String[] args)
{
try{
BufferedReader Questionner = new BufferedReader(new InputStreamReader("java.quiz",false));
BufferedReader listen = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter addrep = new BufferedWriter(new FileWriter("reponses.txt"));
BufferedWriter erased = new BufferedWriter (new FileWriter("reponses.txt",false));
if(listen.readLine() != null)
{
erased.write("");
erased.close();
}
while(Questionner.readLine()){
System.out.println();
addrep.write(listen.readLine().trim());
}
addrep.write(listen.readLine().trim());
addrep.close();
}catch(IOException e){
System.err.println(e.getMessage());
}catch(NumberFormatException e){
System.out.println("erreur");
}
}
}