Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
0
Добавлен:
30.05.2020
Размер:
9.95 Кб
Скачать
unit styd;
interface
uses crt;
type stip=record
nomgr:string[6];
prizv:string[15];
mat:1..5;
ukr:1..5;
inf:1..5;
gd:0..1;
end;
var f,f1:file of stip;
i,k,n,j:byte;
z:stip;
m:array[1..100]of stip;
srbal:real;
st:char;
gr:string[6];
procedure Vvod;
procedure Vyvod;
procedure Dobavit;
procedure Delete;
procedure Redakt;
procedure Vidm;
procedure Tri;
procedure Sort;
implementation
procedure Vvod;
begin
clrscr;
rewrite(f);
i:=1; st:='d';
while st='d' do
begin
clrscr;
writeln('Vvedite Grypy'); readln(z.nomgr);
writeln('Vvedite familiu'); readln(z.prizv);
writeln('Vvedite ocenky po matematike'); readln(z.mat);
writeln('Vvedite ocenky po ukrainskomy'); readln(z.ukr);
writeln('Vvedite ocenky po informatike'); readln(z.inf);
writeln('Y4astvyet li 4elovek v obwestvennoi deyatel`nosti 0-net 1-da'); readln(z.gd);
write(f,z);
i:=i+1;
writeln('Hotite prodoljit`(d/n)'); readln(st);
end;
close(f);
end;
procedure Vyvod;
begin
clrscr;
reset (f);
textcolor(yellow);
writeln(' Stipendiya ');
textcolor(13);
gotoxy(1,2); writeln('#');
gotoxy(4,2); writeln('Grypa');
gotoxy(12,2); writeln('Familiya');
gotoxy(24,2); writeln('Mat');
gotoxy(28,2); writeln('Ukr');
gotoxy(32,2); writeln('Inf');
gotoxy(36,2); writeln('Diyal`nist`');
gotoxy(50,2); writeln('stipendiya');
if filesize(f)=0 then begin textcolor (4+16);
writeln('V baze net zapisei'); textcolor(7) end else
for i:=1 to filesize(f) do
begin
read(f,z);
textcolor(2);
gotoxy(1,wherey); write(i);
gotoxy(4,wherey); write(z.nomgr);
gotoxy(12,wherey); write(z.prizv);
gotoxy(24,wherey); write(z.mat);
gotoxy(28,wherey); write(z.ukr);
gotoxy(32,wherey); write(z.inf);
gotoxy(36,wherey);
if z.gd=1 then write('y4astvyet') else write('ne y4astvyet');
gotoxy(50,wherey);
if (z.mat=5) and (z.ukr=5) and (z.inf=5) and ( z.gd=1) then write('+50%')
else
if (z.mat=5) and (z.ukr=5) and (z.inf=5) and (z.gd=0) then write('+25%')
else
if (z.mat>=4) and (z.ukr>=4) and (z.inf>=4) then write('Zvu4aina stupendiya')
else
if (z.mat>=3) and (z.ukr>=3) and (z.inf>=3) and (z.gd=1) then write('Zvu4aina stupendiya')
else write('Net stipendii');
writeln;
end;
close(f);
readkey;
end;
Procedure Dobavit;
begin
clrscr;
reset(f);
seek(f,filesize(f));
i:=filesize(f);
st:='d';
while st='d' do
begin
clrscr;
textcolor(2);
writeln('Vvedite Grypy'); readln(z.nomgr);
writeln('Vvedite familiu'); readln(z.prizv);
writeln('Vvedite ocenky po matematike'); readln(z.mat);
writeln('Vvedite ocenky po ukrainskomy'); readln(z.ukr);
writeln('Vvedite ocenky po informatike'); readln(z.inf);
writeln('Y4astvyet li 4elovek v obwestvennoi deyatel`nosti 0-net 1-da'); readln(z.gd);
write(f,z);
i:=i+1;
writeln('Hotite prodoljit`(d/n)'); readln(st);
end;
close(f);
end;
procedure Delete;
begin
clrscr;
i:=1;
reset(f);
textcolor(yellow);
writeln(' Stipendiya ');
textcolor(13);
gotoxy(1,2); writeln('#');
gotoxy(4,2); writeln('Grypa');
gotoxy(12,2); writeln('Familiya');
gotoxy(24,2); writeln('Mat');
gotoxy(28,2); writeln('Ukr');
gotoxy(32,2); writeln('Inf');
gotoxy(36,2); writeln('Diyal`nist`');
gotoxy(50,2); writeln('stipendiya');
if filesize(f)=0 then begin textcolor (4+16);
writeln('V baze net zapisei'); textcolor(7) end else
while not (eof(f)) do
begin
read(f,z);
textcolor(2);
gotoxy(1,wherey); write(i);
gotoxy(4,wherey); write(z.nomgr);
gotoxy(12,wherey); write(z.prizv);
gotoxy(24,wherey); write(z.mat);
gotoxy(28,wherey); write(z.ukr);
gotoxy(32,wherey); write(z.inf);
gotoxy(36,wherey);
if z.gd=1 then write('y4astvyet') else write('ne y4astvyet');
gotoxy(50,wherey);
if (z.mat=5) and (z.ukr=5) and (z.inf=5) and ( z.gd=1) then write('+50%')
else
if (z.mat=5) and (z.ukr=5) and (z.inf=5) and (z.gd=0) then write('+25%')
else
if (z.mat>=4) and (z.ukr>=4) and (z.inf>=4) then write('Zvu4aina stupendiya')
else
if (z.mat>=3) and (z.ukr>=3) and (z.inf>=3) and (z.gd=1) then write('Zvu4aina stupendiya')
else write('Net stipendii');
writeln;
i:=i+1;
end;
close(f);
writeln;
reset(f);
writeln('Zadaite nomer udalyaemoi zapisi'); readln(i);
if i>filesize(f) then write('Error')
else
begin
assign(f1,'rabota2.dat');
reset(f); rewrite(f1);
for n:=1 to filesize(f) do
begin
read(f,z);
if filepos(f)<>i then write(f1,z);
end;
close(f1); close(f);
erase(f); rename(f1,'stipendiya.dat');
write('Zapis` ydalena');end;
readkey;
end;
procedure Redakt;
begin
clrscr;
reset (f);
textcolor(yellow);
writeln(' Stipendiya ');
textcolor(13);
gotoxy(1,2); writeln('#');
gotoxy(4,2); writeln('Grypa');
gotoxy(12,2); writeln('Familiya');
gotoxy(24,2); writeln('Mat');
gotoxy(28,2); writeln('Ukr');
gotoxy(32,2); writeln('Inf');
gotoxy(36,2); writeln('Diyal`nist`');
gotoxy(50,2); writeln('stipendiya');
if filesize(f)=0 then begin textcolor (4+16);
writeln('V baze net zapisei'); textcolor(7) end else
for i:=1 to filesize(f) do
begin
read(f,z);
textcolor(2);
gotoxy(1,wherey); write(i);
gotoxy(4,wherey); write(z.nomgr);
gotoxy(12,wherey); write(z.prizv);
gotoxy(24,wherey); write(z.mat);
gotoxy(28,wherey); write(z.ukr);
gotoxy(32,wherey); write(z.inf);
gotoxy(36,wherey);
if z.gd=1 then write('y4astvyet') else write('ne y4astvyet');
gotoxy(50,wherey);
if (z.mat=5) and (z.ukr=5) and (z.inf=5) and ( z.gd=1) then write('+50%')
else
if (z.mat=5) and (z.ukr=5) and (z.inf=5) and (z.gd=0) then write('+25%')
else
if (z.mat>=4) and (z.ukr>=4) and (z.inf>=4) then write('Zvu4aina stupendiya')
else
if (z.mat>=3) and (z.ukr>=3) and (z.inf>=3) and (z.gd=1) then write('Zvu4aina stupendiya')
else write('Net stipendii');
writeln;
end;
close(f);
reset(f);
writeln('Vvedite nomer zapisi'); readln(i);
if i>filesize(f) then write ('takoi zapisi nety')
else
begin
seek(f,i-1);
writeln('Vvedite Grypy'); readln(z.nomgr);
writeln('Vvedite familiu'); readln(z.prizv);
writeln('Vvedite ocenky po matematike'); readln(z.mat);
writeln('Vvedite ocenky po ukrainskomy'); readln(z.ukr);
writeln('Vvedite ocenky po informatike'); readln(z.inf);
writeln('Y4astvyet li 4elovek v obwestvennoi deyatel`nosti 0-net 1-da'); readln(z.gd);
write(f,z);
write('Zapis` izmenena');
end;
readkey;
close(f);
end;
procedure Vidm;
begin
clrscr;
reset (f);
textcolor(yellow);
writeln(' Stipendiya ');
textcolor(13);
gotoxy(1,2); writeln('#');
gotoxy(4,2); writeln('Grypa');
gotoxy(12,2); writeln('Familiya');
gotoxy(24,2); writeln('Mat');
gotoxy(28,2); writeln('Ukr');
gotoxy(32,2); writeln('Inf');
gotoxy(36,2); writeln('Diyal`nist`');
gotoxy(50,2); writeln('stipendiya');
n:=1;
for i:=1 to filesize(f) do
begin
read(f,z);
if (z.mat=5) and (z.ukr=5) and (z.inf=5) and (z.gd=0) then
begin
textcolor(2);
gotoxy(1,wherey); write(n);
gotoxy(4,wherey); write(z.nomgr);
gotoxy(12,wherey); write(z.prizv);
gotoxy(24,wherey); write(z.mat);
gotoxy(28,wherey); write(z.ukr);
gotoxy(32,wherey); write(z.inf);
gotoxy(36,wherey);
if z.gd=1 then write('y4astvyet') else write('ne y4astvyet');
gotoxy(50,wherey);
if (z.mat=5) and (z.ukr=5) and (z.inf=5) and ( z.gd=1) then write('+50%')
else
if (z.mat=5) and (z.ukr=5) and (z.inf=5) and (z.gd=0) then write('+25%')
else
if (z.mat>=4) and (z.ukr>=4) and (z.inf>=4) then write('Zvu4aina stupendiya')
else
if (z.mat>=3) and (z.ukr>=3) and (z.inf>=3) and (z.gd=1) then write('Zvu4aina stupendiya')
else write('Net stipendii');
writeln;
n:=n+1;
end;
end;
close(f);
readkey;
end;
procedure Tri;
begin
clrscr;
reset (f);
textcolor(yellow);
writeln(' Stipendiya ');
textcolor(13);
gotoxy(1,2); writeln('#');
gotoxy(4,2); writeln('Grypa');
gotoxy(12,2); writeln('Familiya');
gotoxy(24,2); writeln('Mat');
gotoxy(28,2); writeln('Ukr');
gotoxy(32,2); writeln('Inf');
gotoxy(36,2); writeln('Diyal`nist`');
gotoxy(50,2); writeln('stipendiya');
n:=1;
for i:=1 to filesize(f) do
begin
read(f,z);
if (z.mat=3) and (z.ukr=3) and (z.inf=3) and (z.gd=1) then
begin
textcolor(2);
gotoxy(1,wherey); write(n);
gotoxy(4,wherey); write(z.nomgr);
gotoxy(12,wherey); write(z.prizv);
gotoxy(24,wherey); write(z.mat);
gotoxy(28,wherey); write(z.ukr);
gotoxy(32,wherey); write(z.inf);
gotoxy(36,wherey);
if z.gd=1 then write('y4astvyet') else write('ne y4astvyet');
gotoxy(50,wherey);
if (z.mat=5) and (z.ukr=5) and (z.inf=5) and ( z.gd=1) then write('+50%')
else
if (z.mat=5) and (z.ukr=5) and (z.inf=5) and (z.gd=0) then write('+25%')
else
if (z.mat>=4) and (z.ukr>=4) and (z.inf>=4) then write('Zvu4aina stupendiya')
else
if (z.mat>=3) and (z.ukr>=3) and (z.inf>=3) and (z.gd=1) then write('Zvu4aina stupendiya')
else write('Net stipendii');
writeln;
n:=n+1;
end;
end;
close(f);
readkey;
end;
procedure Sort;
begin
reset(f);
if filesize(f)=0 then write('V baze net zapisej!')
else
begin
i:=1;
while (not eof(f)) do
begin
read(f,z);
m[i]:=z;
i:=i+1;
end;

close(f);
for j:=1 to i do
begin
for n:=1 to i-1 do
begin
if (((m[n].mat+m[n].ukr+m[n].inf)/3)<(m[n+1].mat+m[n+1].ukr+m[n+1].inf)/3) then
begin
z:=m[n];
m[n]:=m[n+1];
m[n+1]:=z;
end;
end;
end;
clrscr;
textcolor(yellow);
gotoxy(1,wherey);writeln('Zda4a sesii stydentamu vidsortovana po serednomy baly:');
textcolor(13);
gotoxy(1,2); writeln('#');
gotoxy(4,2); writeln('Grypa');
gotoxy(15,2); writeln('Familiya');
gotoxy(34,2); writeln('Mat');
gotoxy(38,2); writeln('Ukr');
gotoxy(42,2); writeln('Inf');
gotoxy(46,2); writeln('Sr bal');

for n:=1 to i-1 do
begin
textcolor(2);
srbal:=(m[n].mat+m[n].ukr+m[n].inf)/3;
gotoxy(1,wherey);write(n);
gotoxy(4,wherey);write(m[n].nomgr);
gotoxy(15,wherey);write(m[n].prizv);
gotoxy(35,wherey);write(m[n].mat);
gotoxy(39,wherey);write(m[n].ukr);
gotoxy(43,wherey);write(m[n].inf);
gotoxy(47,wherey);write(srbal:3:2);
writeln;
end;
readln;
end;
end;
end.
end.
Соседние файлы в папке Волошко_1