2 { use linear structure }
3 { tips for fpc - "fpc -mTP name_prog.pas" }
5 IN_FILE_PATH
= 'task_15.in';
6 OUT_FILE_PATH
= 'task15_5.out';
12 END_PHONE
= MAX_LENGTH_LINE
;
14 procedure main( in_path
, out_path
: string);
16 uline_type
= ^type_line
;
20 next_line
: uline_type
;
24 in_file
, out_file
: text;
26 uline_cur
, uline_next
: uline_type
;
27 family_line
, phone_line
: uline_type
;
29 assign( in_file
, in_path
);
32 assign( out_file
, out_path
);
36 for i
:=1 to MAX_LINES
do
40 readln( in_file
, family
, phone
);
41 writeln( family
, phone
);
43 next_line
:= uline_next
;
45 writeln( out_file
, family
, phone
);
46 {find min family and phone}
50 if family_line
^.family
> family
then
51 family_line
:= uline_cur
;
52 if phone_line
^.phone
> phone
then
53 phone_line
:= uline_cur
;
57 family_line
:= uline_cur
;
58 phone_line
:= uline_cur
;
61 uline_cur
:= uline_next
;
65 writeln(out_file
,'Result');
66 writeln( out_file
, 'min family');
68 writeln( out_file
, family
,phone
);
69 writeln( out_file
, 'min phone');
71 writeln( out_file
, family
,phone
);
76 main( IN_FILE_PATH
, OUT_FILE_PATH
);