Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
0
Добавлен:
30.05.2020
Размер:
7.85 Кб
Скачать
unit styd;
interface
uses crt,graph,graf;
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:byte;
z:stip;
st:char;
gr:string[6];
procedure Vvod;
procedure Vyvod;
procedure Sti;
procedure Dobavit;
procedure Delete;
procedure Redakt;
procedure Vidm;
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);
writeln(' Stipendiya ');
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);
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 Sti;
begin
clrscr;
k:=1;
reset(f);
writeln('Vvedite nyjnyu grypy');
readln(gr);
clrscr;
writeln(gr);
gotoxy(1,2); writeln('#');
gotoxy(6,2); writeln('Familiya');
gotoxy(20,2); writeln('Deyatel`nost`');
gotoxy(40,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);
if gr=z.nomgr then
begin
gotoxy(1,wherey); write(k);
gotoxy(6,wherey); write(z.prizv);
gotoxy(20,wherey);
if z.gd=1 then write('y4astvyet') else write('ne y4astvyet');
gotoxy(40,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;
k:=k+1;
end;
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;
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);
while not (eof(f)) do
begin
read(f,z);
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,'rabota.dat');
write('Zapis` ydalena');end;
readkey;
end;
procedure Redakt;
begin
clrscr;
reset (f);
writeln(' Stipendiya ');
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);
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;
Label 0;
begin
clrscr;
reset (f);
writeln(' Stipendiya ');
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');
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
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;
end;
close(f);
readkey;
end;
end.
Соседние файлы в папке Курс