Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
1
Добавлен:
30.05.2020
Размер:
780.18 Кб
Скачать

Література

1. Глинський Я.М., Анохін В.Є., Ряжська В.А. Паскаль. Turbo Pascal і Delphi. Навч. посібн. 5-те доп. вид. – Львів: Деол, СПД Глинський, 2004. – 176 с.

2. Ковалюк Т.В. Основи програмування. – К.: Видавнича група BHV, 2005. – 384c.: іл.

3. Коффман Эллиот Б. Turbo Pascal. Практикум 5-е издание.: пер. с англ. М.: Издательский дом "Вильямс", 2005. – 896 с.: ил.

4. Марченко А.И., Марченко Л.А. Програмирование в среде Turbo Pascal 7.0 / Марченко А.И., Марченко Л.А.: Под ред. Таресенко В.П. – 9-е изд. – К.:Век+, СПб.: КОРОНА-Век, 2007. – 464 с.: ил.

5. Семотюк В. Програмування в середовищі Турбо Паскаль. Львів: БаК, 2000. – 248 с.

Додаток а (Обов’язковий) Лістинг основної програми

program st;

uses crt,styd,graf,poisk;

label 0,1;

Var p:integer;

begin

assign(f,'stipendiya.dat');

vstyp;

1:

textbackground(blue);

clrscr;

textcolor(green);

gotoXY(32,8); writeln('Zdelayte vybor');

textcolor(white);

gotoXY(30,9); writeln('1 - Vvod zapisej');

gotoXY(30,10); writeln('2 - Vyvod zapisej');

gotoXY(30,11); writeln('3 - Stipendiya');

gotoXY(30,12); writeln('4 - Dobavit zapis');

gotoXY(30,13); writeln('5 - Ydalit zapis');

gotoXY(30,14); writeln('6 - Redaktirovat zapis');

gotoXY(30,15); writeln('7 - Spusok vidminnukiv');

gotoXY(30,16); writeln('8 - Seredniy bal');

gotoXY(30,17); writeln('9 - Spusok trie4nukiv aktuvnuh y gd');

gotoXY(30,18); writeln('10 - Vyhod iz programy');

gotoXY(27,19); write('-->');

readln(p);

case p of

1:begin Vvod; goto 1 end;

2:begin Vyvod; goto 1 end;

3:begin Sti; goto 1 end;

4:begin Dobavit; goto 1 end;

5:begin Delete; goto 1 end;

6:begin Redakt; goto 1 end;

7:begin Vidm; goto 1 end;

8:begin Sort; goto 1 end;

9:begin Tri; goto 1 end;

10:goto 0

else goto 1;

end;

0:bb;

end.

Додаток б Лістинг модуля grapf.Tpu

unit graf;

interface

uses crt,graph;

var gd,gm:integer;

errorcode:integer;

procedure mygraphlnit;

procedure vstyp;

procedure bb;

implementation

procedure mygraphlnit;

begin

gd:=detect;

initgraph(gd,gm,'');

errorcode:=graphresult;

if errorcode<>grok then

begin

write('Error',grapherrormsg(errorcode));

writeln('End');

halt(1);

end;

end;

procedure vstyp;

begin

clrscr;

mygraphlnit;

setcolor(3);

settextstyle(0,0,2);

setfillstyle(1,green);

floodfill(320,240,3);

MoveTo(230,200);

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.

Соседние файлы в папке Волошко