ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 17.09.2024
Просмотров: 33
Скачиваний: 0
СОДЕРЖАНИЕ
3.1 Опис структури данних та вимоги до них
3.2 Опис стандартних процедур і функцій, що використовувалися у програмі
3.3 Опис процедур і функцій користувача
3.4 Опис файлів та їх призначення
4 Інструкції для роботи з програмою
5 Приклади тестування та результати роботи програми
Додаток а (Обов’язковий) Лістинг основної програми
Додаток б Лістинг модуля grapf.Tpu
setcolor(Red);
OutText('Fail zapisei');
OutTextXY(140,220,'zda4i sesii stydentami');
settextstyle(0,0,1);
setcolor(0);
OutTextXY(280,260,'Variant 5');
OutTextXY(460,420,'by Voloshko Alexander');
OutTextXY(280,460,'Sumy 2012');
readkey;
closegraph;
end;
procedure bb;
begin
clrscr;
mygraphlnit;
setcolor(14);
setfillstyle(1,8);
floodfill(320,240,14);
settextstyle(0,0,2);
OutTextXY(140,200,'Spasibo za pol`zovanie');
readkey;
closegraph;
end;
end.
Додаток в Лістинг модуля styd.Tpu
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.
Додаток г Лістинг модуля poisk.Tpu
unit poisk;
interface
uses crt,styd;
procedure Sti;
implementation
procedure Sti;
begin
clrscr;
k:=1;
reset(f);
writeln('Vvedite nyjnyu grypy');
readln(gr);
clrscr;
textcolor(yellow);
writeln(gr);
textcolor(13);
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
textcolor(2);
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;
end.