Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Unit MyLib;
- Interface
- type
- masType = array[1..10] of string[25];
- procedure sortirovka(var mas:masType);
- Implementation
- procedure sortirovka(var mas:masType);
- var
- i,j,err,year1,k,year2,count:integer;
- sex,p : char;
- buf:string;
- begin
- i:=1;
- while(i<=10) do
- begin
- if (mas[i][24]='P') and (mas[i][25]='M') then
- begin
- buf := mas[i];
- for j:=i downto 2 do
- begin
- mas[j] := mas[j-1];
- end;
- mas[1] := buf;
- inc(count);
- end;
- inc(i);
- end;
- for i:=1 to count-1 do
- begin
- for j:= i+1 to count do
- begin
- val(copy(mas[i],20,4),year1,err);
- val(copy(mas[j],20,4),year2,err);
- if(year1 < year2) then
- begin
- buf := mas[i];
- mas[i]:= mas[j];
- mas[j] := buf;
- end;
- end;
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement