Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. type
  2. sorevnovanie = record
  3. fam, im: string[20];
  4. nsh: 1..99;
  5. ball: 0..100;
  6. end;
  7. fz = file of sorevnovanie;
  8.  
  9. procedure zadanie_1(var T: text; var f: fz);
  10. var
  11. temp: sorevnovanie;
  12. c: char;
  13. begin
  14. reset(T);
  15. rewrite(f);
  16. while not eof(T) do
  17. begin
  18. temp.fam := '';
  19. {прочитаваем посимвольно фамилию очередного ученика}
  20. repeat
  21. read(T, c);
  22. temp.fam := temp.fam + c;
  23. until c = ' ';
  24. temp.im := '';
  25. {прочитаваем посимвольно имя очередного ученика}
  26. repeat
  27. read(T, c);
  28. temp.im := temp.im + c;
  29. until c = ' ';
  30.  
  31. temp.nsh:=1..99;
  32. {считываем номер школы}
  33. repeat
  34. read(T, c);
  35. temp.nsh :=temp.nsh +c;
  36. until
  37. c='';
  38. temp.ball :=0..100;
  39. {считываем баллы}
  40. repeat
  41. read(T, c);
  42. temp.ball :=temp.ball +c;
  43. until
  44. c='';
  45. end;
  46. end;
  47.  
  48. procedure print_binary_file(var f: fz);
  49. var
  50. temp: sorevnovanie;
  51. begin
  52. reset(f);
  53. while not eof(f) do
  54. begin
  55. read(f, temp);
  56. write(temp.fam);
  57. for var i := 1 to 21 - length(temp.fam) do
  58. write(' ');
  59. write(temp.im);
  60. for var i := 1 to 21 - length(temp.im) do
  61. write(' ');
  62. writeln(temp.nsh:5, temp.ball:5 );
  63. end
  64. end;
  65.  
  66.  
  67.  
  68. var
  69. T: text;
  70. f: fz;
  71.  
  72. begin
  73. assign(T, 'G:\26lab.txt'); {исходный файл}
  74. assign(f, 'lr_26.dat'); {бинарный файл}
  75. zadanie_1(T, f);
  76. print_binary_file(f);
  77. writeln;
  78.  
  79. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement