2 { use record type and use type file }
3 { tips for fpc - "fpc -mTP name_prog.pas" }
5 IN_FILE_PATH
= 'task_15.in';
6 OUT_FILE_PATH
= 'task_15_mod_3.out';
12 END_PHONE
= MAX_LENGTH_LINE
;
22 in_file
: file of type_line
;
25 in_lines
: array [1 .. MAX_LINES
] of type_line
;
26 result_line
: type_line
;
28 procedure find_min_phone_and_first_letter_family(i
: integer; var result_line
: type_line
);
32 if in_lines
[i
].family
[1] <= result_line
.family
[1] then
34 if in_lines
[i
].phone
< result_line
.phone
then
36 result_line
:= in_lines
[i
];
41 result_line
:= in_lines
[i
];
43 {END procedure find_min_phone_and_first_letter_family}
45 assign( in_file
, IN_FILE_PATH
);
47 writeln( filesize( in_file
) );
48 writeln( filepos( in_file
) );
49 assign( out_file
, OUT_FILE_PATH
);
53 for i
:=1 to MAX_LINES
do
55 {START read from in_file and write in out_file}
56 read( in_file
, in_lines
[i
] );
57 writeln( out_file
, in_lines
[i
].family
, in_lines
[i
].phone
);
59 find_min_phone_and_first_letter_family(i
,result_line
);
64 writeln(out_file
,'Result');
66 writeln( out_file
, family
, phone
);