Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. Uses crt;
  2.  
  3. type
  4. info = record
  5. fio:string[19];
  6. year:integer;
  7. visa:char;
  8. male:char;
  9. end;
  10.  
  11.  
  12.  
  13. masType = array[1..10] of info;
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. var
  23. mas:masType;
  24. i,err,j:integer;
  25. c:char;
  26. year:string;
  27.  
  28. (*procedure sortirovka(var mas:masType);
  29. var
  30. i,j,err,year1,k,year2,count:integer;
  31. sex,p : char;
  32. buf:string;
  33.  
  34. begin
  35. i:=1;
  36. while(i<=10) do
  37. begin
  38. //val(copy(mas[i],20,4),year,err);
  39.  
  40. if (mas[i][24]='P') and (mas[i][25]='M') then
  41. begin
  42.  
  43.  
  44. buf := mas[i];
  45. for j:=i downto 2 do
  46. begin
  47.  
  48.  
  49.  
  50.  
  51. mas[j] := mas[j-1];
  52. end;
  53. mas[1] := buf;
  54. inc(count);
  55.  
  56.  
  57. end;
  58.  
  59.  
  60. inc(i);
  61.  
  62. //writeln(year);
  63. end;
  64.  
  65.  
  66.  
  67.  
  68. for i:=1 to count-1 do
  69. begin
  70. for j:= i+1 to count do
  71. begin
  72. val(copy(mas[i],20,4),year1,err);
  73. val(copy(mas[j],20,4),year2,err);
  74. if(year1 < year2) then
  75. begin
  76. buf := mas[i];
  77. mas[i]:= mas[j];
  78. mas[j] := buf;
  79. end;
  80. end;
  81.  
  82. end;
  83.  
  84. end;*)
  85.  
  86.  
  87.  
  88. begin
  89. assign(input,'input.txt');
  90. reset(input);
  91. //assign(output,'output.txt');
  92. //rewrite(output);
  93.  
  94. for i:=1 to 10 do
  95. begin
  96.  
  97.  
  98. for j:=1 to 19 do
  99. begin
  100. read(input,c);
  101. mas[i].fio := mas[i].fio + c;
  102. end;
  103. year := '';
  104. for j:=1 to 4 do
  105. begin
  106. read(input,c);
  107. year := year + c;
  108. end;
  109. val(year,mas[i].year,err);
  110.  
  111.  
  112. read(input,mas[i].visa);
  113. readln(input,mas[i].male);
  114.  
  115.  
  116.  
  117. end;
  118. close(input);
  119.  
  120. for i:=1 to 10 do
  121. begin
  122. writeln(mas[i].fio,mas[i].year,' ',mas[i].visa,' ',mas[i].male);
  123. end;
  124. assign(output,'output.txt');
  125. rewrite(output);
  126.  
  127. for i:=1 to 10 do
  128. begin
  129. writeln(output,mas[i].fio,mas[i].year,' ',mas[i].visa,' ',mas[i].male);
  130. end;
  131. close(output);
  132.  
  133.  
  134. (*for i:=1 to 10 do
  135. writeln(mas[i]);
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142. sortirovka(mas);
  143.  
  144.  
  145.  
  146.  
  147. writeln;
  148.  
  149. for i:=1 to 10 do
  150. writeln(mas[i]);
  151.  
  152.  
  153. append(output);
  154.  
  155. writeln(output);
  156.  
  157. for i:=1 to 3 do
  158. begin
  159.  
  160. writeln(output,mas[i]);
  161. end;
  162. close(output);
  163.  
  164. writeln;
  165. for i:=1 to 3 do
  166. begin
  167.  
  168. writeln(mas[i]);
  169. end;
  170.  
  171. *)
  172. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement