Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. Unit MyLib;
  2.  
  3. Interface
  4. type
  5. masType = array[1..10] of string[25];
  6.  
  7. procedure sortirovka(var mas:masType);
  8.  
  9. Implementation
  10.  
  11.  
  12. procedure sortirovka(var mas:masType);
  13. var
  14. i,j,err,year1,k,year2,count:integer;
  15. sex,p : char;
  16. buf:string;
  17.  
  18. begin
  19. i:=1;
  20. while(i<=10) do
  21. begin
  22.  
  23.  
  24. if (mas[i][24]='P') and (mas[i][25]='M') then
  25. begin
  26.  
  27.  
  28. buf := mas[i];
  29. for j:=i downto 2 do
  30. begin
  31.  
  32.  
  33.  
  34.  
  35. mas[j] := mas[j-1];
  36. end;
  37. mas[1] := buf;
  38. inc(count);
  39.  
  40.  
  41. end;
  42.  
  43.  
  44. inc(i);
  45.  
  46.  
  47. end;
  48.  
  49.  
  50.  
  51.  
  52. for i:=1 to count-1 do
  53. begin
  54. for j:= i+1 to count do
  55. begin
  56. val(copy(mas[i],20,4),year1,err);
  57. val(copy(mas[j],20,4),year2,err);
  58. if(year1 < year2) then
  59. begin
  60. buf := mas[i];
  61. mas[i]:= mas[j];
  62. mas[j] := buf;
  63. end;
  64. end;
  65.  
  66. end;
  67.  
  68. end;
  69.  
  70.  
  71. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement