Advertisement
Guest User

Untitled

a guest
May 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. uses crt;
  2. const n=100;
  3. type rec=record
  4. fio:string[20];
  5. oz:array[1..4] of byte;
  6. sr:real;
  7. end;
  8. var st:array [1..n] of rec;
  9. srb,q:real;
  10. i,j,nm,m,d:byte; buf:rec; max:real;
  11. pr:boolean;
  12. a:rec;
  13. s:array [1..4]of real;
  14. f:file of rec;
  15. c:char;
  16. begin
  17. clrscr;
  18. assign(f,'dxca.dat');
  19. {$i-} reset (f); {$I+}
  20. if ioresult <> 0 then
  21. begin
  22. writeln('sozdat file');
  23. rewrite (f);
  24. repeat
  25. write('vvedite fio:');
  26. readln(a.fio);
  27. for j:=1 to 4 do
  28. begin
  29. write('Vvedite ocenky:');
  30. readln (a.oz[j]);
  31. end;
  32.  
  33.  
  34. write(f,a);
  35. writeln('Prodoljit vvod? Y/N');
  36. c:=readkey;
  37. until upcase(c)='N';
  38. close(f);
  39. end;
  40. reset(f);
  41. for i:= 1 to m do
  42. begin
  43. write(st[i].fio,' ');
  44. for j:=1 to 4 do write(st[i].oz[j],' ');
  45. end;
  46. readln;
  47. i:=0;
  48. while not EOF (f) do
  49. begin
  50. read(f,a);
  51. inc(i);
  52. st[i]:=a;
  53. end;
  54. m:=i;
  55.  
  56. for i:=1 to m do
  57. begin
  58. for j:=1 to 4 do
  59. begin
  60. q:=q+st[i].oz[j];
  61. end;
  62. st[i].sr:=q/4;
  63. writeln(st[i].sr:6:2);
  64. end;
  65. for j:=1 to 4 do
  66. begin
  67. q:=0;
  68. for i:=1 to m do
  69. begin
  70. q:=q+st[i].oz[j];
  71. end;
  72. srb:=q/m;
  73. s[j]:=srb;
  74. end;
  75. max:=0;
  76. for j:=1 to 4 do
  77. if s[j]>max then begin
  78. max:=s[j];
  79. d:=j;
  80. end;
  81. if d=1 then writeln('MAX Matematika- ', max:6:2);
  82. if d=2 then writeln('MAX Fizika- ', max:6:2);
  83. if d=3 then writeln('MAX Informatika- ', max:6:2);
  84. if d=4 then writeln('MAX Biologia- ', max:6:2);
  85. begin
  86. buf:=st[i];
  87. st[i]:=st[i+1];
  88. st[i+1]:=buf;
  89. pr:=false;
  90. end;
  91. for i:= 1 to m do
  92. begin
  93. write(st[i].fio,' ');
  94. for j:=1 to 4 do write(st[i].oz[j],' ');
  95. writeln; end;
  96. readln;
  97. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement