Добавил:
Tushkan
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабораторные работы_2 / LAB7 / LAB7
.PAS program Lab7_Zaharov;
uses crt;
type
Tstudent = record
FIO : string [30];
day : 1..31;
month : 1..12;
year : 1900..1995;
kurs : 1..6;
group : string [8];
bal : 0..5;
home : string [11];
end;
var
fin : text;
fout : file of Tstudent;
student : Tstudent;
fl : boolean;
{Џа®жҐ¤га ўлў®¤ ®¬ «ЁЁ нЄа }
procedure Anomaliya (text1, text2 : string; var p_repeat : boolean);
var p_key : char;
y : integer;
i,k : byte;
begin
clrscr;
if p_repeat=true then k:=4 else k:=2;
textcolor(k);
y:=(82 - 4 - length (text1)) div 2;
gotoxy (y,10); write ('Й'); for i:=1 to length (text1)+2 do write ('Н'); write ('»');
gotoxy (y,11); write ('є '); textcolor (k+240); write (text1); textcolor (k); write (' є');
gotoxy (y,12); write ('И'); for i:=1 to length (text1)+2 do write ('Н'); write ('ј');
if length(text2)<>0
then
begin
textcolor (8);
y:=(82 - 8 - length (text2)) div 2;
gotoxy (y,13); write ('Ъ'); for i:=1 to length (text2)+6 do write ('Д'); write ('ї');
gotoxy (y,14); write ('і ',text2,' і');
gotoxy (y,15); write ('А'); for i:=1 to length (text2)+6 do write ('Д'); write ('Щ');
end;
gotoxy(1,1);
if p_repeat=true then
repeat
sound (800); delay (40000);
nosound; delay (50000);
until keypressed
else repeat until keypressed;
k:=1; p_repeat:=true;
gotoxy (60,20); textcolor (blue); write ('ЪДДДДДДДДДДДї');
gotoxy (60,23); textcolor (blue); write ('АДДДДДДДДДДДЩ');
repeat gotoxy (60,21); clreol;
textcolor (15);
textbackground (0);
textcolor (blue); write ('і');
textcolor (15);
if k=1 then textbackground(blue) else textbackground(0);
write (' ЏЋ‚’Ћђ€’њ ');
textbackground (0);
textcolor (blue); write ('і');
textcolor (15);
gotoxy (60,22); clreol;
textcolor (15);
textbackground (0);
textcolor (blue); write ('і');
textcolor(15);
if k=2 then textbackground(blue) else textbackground(0);
write (' ‡Ђ‚…ђ€’њ ');
textbackground (0);
textcolor (blue); write ('і');
textcolor (15);
repeat
p_key:=readkey;
until (p_key=chr(72)) or (p_key=chr(80)) or (p_key=chr(13));
if ((p_key=chr(72)) or (p_key=chr(80))) and (k=1)
then begin k:=2; p_repeat:=false; end
else if ((p_key=chr(72)) or (p_key=chr(80))) and (k=2)
then begin k:=1; p_repeat:=true; end
else
if p_key=chr(13)
then k:=3;
until (k=3);
clrscr;
end;
{ѓ« ў п Їа®Ја ¬¬ }
begin
repeat
clrscr;
writeln;
writeln (' ‹ Ў®а в®а п а Ў®в # 7');
writeln (' ” ©«л б дЁЄбЁа®ў л¬Ё § ЇЁбп¬Ё.');
writeln;
writeln ('‘в㤥вл ЈагЇЇл Ђ-13-08Ў Їа®¦Ёў ойЁҐ ў ®ЎйҐ¦ЁвЁЁ:');
assign (fin,'G:\LAB7\fin.txt');
reset (fin);
{‘®§¤ ЁҐ вЁЇЁ§Ёа®ў ®Ј® д ©« }
assign (fout,'G:\LAB7\fout.dat');
rewrite (fout);
while not eof (fin) do
begin
with student do read (fin,FIO,day,month,year,kurs,group,bal,home);
readln (fin);
write (fout,student);
end;
{Џ®ЁбЄ ў вЁЇЁ§Ёа®ў ®¬ д ©«Ґ}
fl:=true;
reset (fout);
read (fout,student);
while not eof (fout) do
begin
if ((student.group=' A-13-08') and (student.home=' obshejitie'))
then
begin
writeln (student.FIO);
fl:=false;
end;
read (fout,student);
end;
{Џа®ўҐаЄ ®¬ «м®© бЁвг жЁЁ}
if fl=false
then
begin
readln;
Anomaliya ('Џа®Ја ¬¬ ўлЇ®«Ґ гбЇҐи®.','',fl);
end
else Anomaliya ('‚Ё¬ ЁҐ! ЋиЁЎЄ !','‚ д ©«Ґ ®вбгвбвўгов ЁбЄ®¬лҐ н«Ґ¬Ґвл',fl);
until fl=false;
end.
uses crt;
type
Tstudent = record
FIO : string [30];
day : 1..31;
month : 1..12;
year : 1900..1995;
kurs : 1..6;
group : string [8];
bal : 0..5;
home : string [11];
end;
var
fin : text;
fout : file of Tstudent;
student : Tstudent;
fl : boolean;
{Џа®жҐ¤га ўлў®¤ ®¬ «ЁЁ нЄа }
procedure Anomaliya (text1, text2 : string; var p_repeat : boolean);
var p_key : char;
y : integer;
i,k : byte;
begin
clrscr;
if p_repeat=true then k:=4 else k:=2;
textcolor(k);
y:=(82 - 4 - length (text1)) div 2;
gotoxy (y,10); write ('Й'); for i:=1 to length (text1)+2 do write ('Н'); write ('»');
gotoxy (y,11); write ('є '); textcolor (k+240); write (text1); textcolor (k); write (' є');
gotoxy (y,12); write ('И'); for i:=1 to length (text1)+2 do write ('Н'); write ('ј');
if length(text2)<>0
then
begin
textcolor (8);
y:=(82 - 8 - length (text2)) div 2;
gotoxy (y,13); write ('Ъ'); for i:=1 to length (text2)+6 do write ('Д'); write ('ї');
gotoxy (y,14); write ('і ',text2,' і');
gotoxy (y,15); write ('А'); for i:=1 to length (text2)+6 do write ('Д'); write ('Щ');
end;
gotoxy(1,1);
if p_repeat=true then
repeat
sound (800); delay (40000);
nosound; delay (50000);
until keypressed
else repeat until keypressed;
k:=1; p_repeat:=true;
gotoxy (60,20); textcolor (blue); write ('ЪДДДДДДДДДДДї');
gotoxy (60,23); textcolor (blue); write ('АДДДДДДДДДДДЩ');
repeat gotoxy (60,21); clreol;
textcolor (15);
textbackground (0);
textcolor (blue); write ('і');
textcolor (15);
if k=1 then textbackground(blue) else textbackground(0);
write (' ЏЋ‚’Ћђ€’њ ');
textbackground (0);
textcolor (blue); write ('і');
textcolor (15);
gotoxy (60,22); clreol;
textcolor (15);
textbackground (0);
textcolor (blue); write ('і');
textcolor(15);
if k=2 then textbackground(blue) else textbackground(0);
write (' ‡Ђ‚…ђ€’њ ');
textbackground (0);
textcolor (blue); write ('і');
textcolor (15);
repeat
p_key:=readkey;
until (p_key=chr(72)) or (p_key=chr(80)) or (p_key=chr(13));
if ((p_key=chr(72)) or (p_key=chr(80))) and (k=1)
then begin k:=2; p_repeat:=false; end
else if ((p_key=chr(72)) or (p_key=chr(80))) and (k=2)
then begin k:=1; p_repeat:=true; end
else
if p_key=chr(13)
then k:=3;
until (k=3);
clrscr;
end;
{ѓ« ў п Їа®Ја ¬¬ }
begin
repeat
clrscr;
writeln;
writeln (' ‹ Ў®а в®а п а Ў®в # 7');
writeln (' ” ©«л б дЁЄбЁа®ў л¬Ё § ЇЁбп¬Ё.');
writeln;
writeln ('‘в㤥вл ЈагЇЇл Ђ-13-08Ў Їа®¦Ёў ойЁҐ ў ®ЎйҐ¦ЁвЁЁ:');
assign (fin,'G:\LAB7\fin.txt');
reset (fin);
{‘®§¤ ЁҐ вЁЇЁ§Ёа®ў ®Ј® д ©« }
assign (fout,'G:\LAB7\fout.dat');
rewrite (fout);
while not eof (fin) do
begin
with student do read (fin,FIO,day,month,year,kurs,group,bal,home);
readln (fin);
write (fout,student);
end;
{Џ®ЁбЄ ў вЁЇЁ§Ёа®ў ®¬ д ©«Ґ}
fl:=true;
reset (fout);
read (fout,student);
while not eof (fout) do
begin
if ((student.group=' A-13-08') and (student.home=' obshejitie'))
then
begin
writeln (student.FIO);
fl:=false;
end;
read (fout,student);
end;
{Џа®ўҐаЄ ®¬ «м®© бЁвг жЁЁ}
if fl=false
then
begin
readln;
Anomaliya ('Џа®Ја ¬¬ ўлЇ®«Ґ гбЇҐи®.','',fl);
end
else Anomaliya ('‚Ё¬ ЁҐ! ЋиЁЎЄ !','‚ д ©«Ґ ®вбгвбвўгов ЁбЄ®¬лҐ н«Ґ¬Ґвл',fl);
until fl=false;
end.