>>227 procedure search; var name : packed array [1..10] of char; c : boolean; begin Readln(name); while name <> 'end' do begin Reset(opfile); c := true; while not eof(opfile) do begin Read(opfile, a); if a.name = name then begin Writeln(a.tel); c := false; end; end; Close(opfile); if c then Writeln('該当者なし'); Readln(name); end; end; { search }
>>228 program test1(input); var o,e : file of integer; i:integer;begin Assign(o,'oddsequence');Rewrite(o); Read(i);while i <> 0 do begin Write(o,i); Read(i); end; Assign(e,'evensequence');Rewrite(e); Read(i);while i <> 0 do begin Write(e,i); Read(i); end; Close(o);Close(e);end.
program test2(output); var o,e,s : file of integer; i,j:integer;begin Assign(o,'oddsequence');Reset(o); Assign(e,'evensequence');Reset(e); Assign(s,'sequence');Rewrite(s);i := 0; j := 0; while not (eof(o) and eof(e) and (i = 0) and (j = 0)) do begin if not eof(o) and (i = 0) then Read(o,i); if not eof(e) and (j = 0) then Read(e,j); if (i <> 0) and (i < j) then begin Write(s,i); i := 0; end else if j <> 0 then begin Write(s,j); j := 0; end; end; Reset(s); while not eof(s) do begin Read(s,i);Write(i);Write(' '); end;Close(o);Close(e);Close(s);end.