Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses crt;
- const n=100;
- type rec=record
- fio:string[20];
- oz:array[1..4] of byte;
- sr:real;
- end;
- var st:array [1..n] of rec;
- srb,q:real;
- i,j,nm,m,d:byte; buf:rec; max:real;
- pr:boolean;
- a:rec;
- s:array [1..4]of real;
- f:file of rec;
- c:char;
- begin
- clrscr;
- assign(f,'dxca.dat');
- {$i-} reset (f); {$I+}
- if ioresult <> 0 then
- begin
- writeln('sozdat file');
- rewrite (f);
- repeat
- write('vvedite fio:');
- readln(a.fio);
- for j:=1 to 4 do
- begin
- write('Vvedite ocenky:');
- readln (a.oz[j]);
- end;
- write(f,a);
- writeln('Prodoljit vvod? Y/N');
- c:=readkey;
- until upcase(c)='N';
- close(f);
- end;
- reset(f);
- for i:= 1 to m do
- begin
- write(st[i].fio,' ');
- for j:=1 to 4 do write(st[i].oz[j],' ');
- end;
- readln;
- i:=0;
- while not EOF (f) do
- begin
- read(f,a);
- inc(i);
- st[i]:=a;
- end;
- m:=i;
- for i:=1 to m do
- begin
- for j:=1 to 4 do
- begin
- q:=q+st[i].oz[j];
- end;
- st[i].sr:=q/4;
- writeln(st[i].sr:6:2);
- end;
- for j:=1 to 4 do
- begin
- q:=0;
- for i:=1 to m do
- begin
- q:=q+st[i].oz[j];
- end;
- srb:=q/m;
- s[j]:=srb;
- end;
- max:=0;
- for j:=1 to 4 do
- if s[j]>max then begin
- max:=s[j];
- d:=j;
- end;
- if d=1 then writeln('MAX Matematika- ', max:6:2);
- if d=2 then writeln('MAX Fizika- ', max:6:2);
- if d=3 then writeln('MAX Informatika- ', max:6:2);
- if d=4 then writeln('MAX Biologia- ', max:6:2);
- begin
- buf:=st[i];
- st[i]:=st[i+1];
- st[i+1]:=buf;
- pr:=false;
- end;
- for i:= 1 to m do
- begin
- write(st[i].fio,' ');
- for j:=1 to 4 do write(st[i].oz[j],' ');
- writeln; end;
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement