Скачиваний:
127
Добавлен:
08.05.2014
Размер:
5.99 Кб
Скачать
program pro4;
uses Crt;
type Znak = record
Name:string[18];
Zod:string[10];
Bday:array[1..3] of Integer;
end;
var menu:array[1..3] of string[20]; l,number:Byte; Ch:Char;
book:array[1..10] of Znak; f:Text; z:string[10]; found:Boolean;

procedure DataOrigin;
var i,j:Byte;
begin
Reset(f); i:=1;
while not Eof(f) do begin
with book[i] do begin
Readln(f,Name); Readln(f,Zod);
if (Name='') and (zod='') then Exit;
for j:=1 to 3 do Readln(f,Bday[j]); Readln(f);
Inc(i);
end;
number:=i-1;
end;
end;

procedure Sort;
var book1:znak; i,j:Byte;
begin
for i:=1 to number do begin
for j:=number downto 1 do begin
if (book[j].bday[1]<book[j-1].bday[1]) or
(book[j].bday[2]<book[j-1].bday[2]) or
(book[j].bday[3]<book[j-1].bday[3]) then begin
book1:=book[j-1];
book[j-1]:=book[j];
book[j]:=book1;
end;
end;
end;
end;

procedure List(l,m:Byte);
var n:string[12]; i:Byte;
begin
for i:=1 to number do begin
with book[i] do begin
if bday[1] = 0 then Exit;
n:=name;
if (l=1) then if zod=z then
begin found:=true;
TextColor(11); end
else TextColor(12);
if l=0 then TextColor(12);
gotoXY(34,5+i); Write(n);
gotoXY(49,5+i); Write(Zod);
gotoXY(63,5+i); Write(bday[1]:2,':');
gotoXY(66,5+i); Write(bday[2]:2,':');
gotoXY(70,5+i); Write(bday[3]:2);
end;
end;
end;

procedure Env1;
var i,j:Byte;
begin TextColor(5);
gotoXY(32,2); Write('ЙННННННННННННННЛНННННННННННННЛННННННННННН»');
gotoXY(32,3); Write('є €¬п є ‡­ Є є „ в  є');
gotoXY(32,4); Write('є є §®¤Ё Є  є ஦¤Ґ­Ёп є');
gotoXY(32,5); Write('МННННННННННННННОНННННННННННННОННННННННННН№');
for i:=6 to 23 do begin
gotoXY(32,i); Write('є є є є');
end;
gotoXY(32,24); Write('ИННННННННННННННКНННННННННННННКНННННННННННј');
end;

procedure Cursor;
var i:Byte;
begin
TextColor(8);
for i:=1 to 3 do begin gotoXY(4,3+i); Writeln(menu[i]); end;
end;

procedure OutSection;
begin
clrscr; Env1; List(0,0); Cursor;
end;

procedure InputData;
var j:Byte;
begin
TextBackground(0);
TextColor(6);
gotoXY(1,11); Writeln('ЙННННННННННННННННННННННННН»');
gotoXY(1,12); Writeln('є ‚ў®¤ ¤ ­­ле є');
gotoXY(1,13); Writeln('ЗДДДДДДДДДДДДДДДДДДДДДДДДД¶');
gotoXY(1,14); Writeln('є €¬п: є');
gotoXY(1,15); Writeln('є ‡­ Є §®¤Ё Є : є');
gotoXY(1,16); Writeln('є є');
gotoXY(1,17); Writeln('є „ в  ஦¤Ґ­Ёп: є');
gotoXY(1,18); Writeln('є є');
gotoXY(1,19); Writeln('є зЁб«®: є');
gotoXY(1,20); Writeln('є є');
gotoXY(1,21); Writeln('є ¬Ґбпж: є');
gotoXY(1,22); Writeln('є є');
gotoXY(1,23); Writeln('є Ј®¤: є');
gotoXY(1,24); Writeln('ИНННННННННННННННННННННННННј'); TextColor(4);
gotoXY(3,14); Write('1'); gotoXY(3,15); Write('2');
gotoXY(3,19); Write('3'); gotoXY(3,21); Write('4');
gotoXY(3,23); Write('5'); TextColor(7);
Inc(Number);
while True do begin
with book[number] do begin
repeat
ch:=readkey;
case UpCase(Ch) of
'1': begin gotoXY(10,14); Readln(Name); end;
'2': begin gotoXY(5,16); Readln(Zod); end;
'3': begin gotoXY(11,19); Readln(Bday[1]); end;
'4': begin gotoXY(11,21); Readln(Bday[2]); end;
'5': begin gotoXY(11,23); Readln(Bday[3]); end;
end;
if Ord(Ch)=27 then begin Dec(Number); OutSection; Exit; end;
if Ord(Ch)=13 then begin OutSection; Exit; end;
until (bday[1]>0) and (bday[1]<32) and (bday[2]<13) and
(bday[2]>0) and (bday[3]>0) and (bday[3]<100);
end;
end;
end;

procedure Search;
var i:Byte;
begin
TextColor(9); TextBackground(0);
gotoXY(1,11); Writeln('ЙННННННННННННННННННННННННН»');
gotoXY(1,12); Writeln('є Џ®ЁбЄ є');
gotoXY(1,13); Writeln('ЗДДДДДДДДДДДДДДДДДДДДДДДДД¶');
gotoXY(1,14); Writeln('є ‡­ Є §®¤Ё Є : є');
gotoXY(1,15); Writeln('є є');
gotoXY(1,16); Writeln('ИНННННННННННННННННННННННННј'); TextColor(7);
while True do begin
Ch:=readkey;
gotoXY(4,15); Readln(z);
Ch:=readkey;
if Ord(Ch)=27 then begin OutSection; Exit; end;
if Ord(Ch)=13 then
begin OutSection; found:=false;
List(1,0);

if found=false then begin gotoXY(2,14); TextBackground(4);
TextColor(160);
Write(' Ё­д®а¬ жЁп ­Ґ ­ ©¤Ґ­  ');
Readkey; gotoXY(2,14); TextColor(0); TextBackground(0);
Write(' ');
end;
Readkey;
OutSection; Exit;
end;
end;
end;

begin
Assign(f,'exp5_dat.txt');
DataOrigin; Sort;
menu[1]:=' ‚ў®¤ ¤ ­­ле ';
menu[2]:=' Џ®ЁбЄ ';
menu[3]:=' ‚л室 ';
OutSection; l:=1;
while True do begin
Ch:=readkey;
case Ord(Ch) of
72: begin
TextColor(8); TextBackground(0);
gotoXY(4,l+3); Write(menu[l]);
Dec(l); if l=0 then l:=3;
TextColor(0); TextBackground(2);
gotoXY(4,l+3); Write(menu[l]);
end;
80: begin
TextColor(8); TextBackground(0);
gotoXY(4,l+3); Write(menu[l]);
Inc(l); if l=4 then l:=1;
TextColor(0); TextBackground(2);
gotoXY(4,l+3); Write(menu[l]);
end;
end;
if Ord(Ch) = 13 then begin
if l=1 then begin InputData; l:=1; end;
if l=2 then begin Search; l:=1; end;
if l=3 then begin TextColor(7); TextBackground(0); clrscr; Halt; end;
end;
end;
end.
Соседние файлы в папке задание №4 — 7