Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  FormatConverter
Language: PASCAL
Code:
Program FormatConverter(input,output);
var
  p: integer;
  a,b,rida: string;
  tabel1,tabel2: text;

begin
  assign(tabel1,'input.txt');
  assign(tabel2,'output.txt');
  reset(tabel1);
  rewrite(tabel2);
  p:=0;
  repeat
    readln(tabel1,rida);
    p:=pos(' ',rida);
    writeln(tabel2,copy(rida,1,p-1),#13,#10);
    Delete(rida,1,p-1);
    a:='';
    b:='';
    repeat
      a:=concat(a,' ',copy(rida,2,1));
      b:=concat(b,' ',copy(rida,3,1));
      Delete(rida,1,3)
    until byte(rida[0])=0;
    delete(a,1,1);
    delete(b,1,1);
    writeln(tabel2,a,#13,#10);
    writeln(tabel2,b,#13,#10);
  until EOF(tabel1);
  close(tabel1);
  close(tabel2);
  readln(a);
end.     
Comments: