If n then begin

help_line(' Пустых разделов нет');

write(^G);{Для звукового сопровождения отсутствия пустых разделов}

readkey;

end;

end;

procedure OTabl.read_f;

Begin

Assign(f,'tab.dat');

{$I-}

reset(f);

{$I+}

if ioresult<>0 then exit;

While not eof(f) do

Begin

read(f,iEl);

new_el_tb(iEl);

end;

close(f);

end;

procedure OTabl.save_f;

var i:word;

Begin

assign(f,'tab.dat');

rewrite(f);

for i:=0 to 9 do

Begin

P:=Tbl^[i];

while P<>nil do

Begin

write(f,P^.el);

P:=P^.pnext;

end;

end;

close(f);

end;

procedure oTabl.show_tb;

var i: word;

l: byte;

Begin

window(4,6,76,24); clrscr;

write(' Ключ раздела',' Номер ':6);

writeln(' Название раздела':30);

L:=0;

for i:=0 to 9 do

Begin

T:=Tbl^[i];p:=T;

while P<> nil do

Begin

write (i:10);

writeln(' |',P^.el.nn:6,' |',P^.el.ik:15,' |',P^.el.st:34,' |');

P:=P^.pnext;

end;

end;

readkey;

window(1,3,80,25);

end;

destructor OTabl.done;

var i:word;{при выходе уничтожаем все списки}

Begin

for i:=0 to 9 do

Begin

P:=Tbl^[i];

while P<> nil do

Begin

Q:=P;

P:=P^.pnext;

dispose(Q);

end;

Tbl^[i]:=nil;

end;

init_ok:=false;

end;

Begin

init_ok:=false;

End.

unit menu1;

Interface

procedure menu_;

{Работа только с меню для обработки таблицы, описывающей работу с библиотекой данных }

Implementation

uses crt,Utable,utils;

Var

stop:boolean;

Tbl:OTabl;

L:byte;

function run_menu:byte;{главное меню с основными пунктами работы}

Begin

window(1,1,80,25);

clrscr;

gotoxy(1,1);

textcolor(15);

textbackground(11);

gotoxy(1,1); write(' Файл ');

gotoxy(11,1); write(' Таблица ');

gotoxy(72,1); write(' Выход ');

textbackground(1);

textcolor(7);

stop:=false;

L:=1;

Case readkey of

#0: case readkey of

#75: if L>1 then dec(L);

#77: if L<3 then inc(L);

end;{case}

#13: begin

stop:=true;

run_menu:=L;

end;

end;

run_menu:=L;

textbackground(0);

window(1,1,80,25);

While not stop do

Begin

Case L of

Begin

gotoxy(1,1);

textcolor(15);

write(' Файл ');

help_line(' Операции с файлом');

end;

Begin

gotoxy(11,1);

textcolor(15);

write(' Таблица ');

help_line(' Операции с таблицей ');

end;

Begin

gotoxy(72,1);

textcolor(15);

write(' Выход ');

help_line(' Закончить работу ');

end;

end;{case}

Case readkey of

#0: case readkey of

#75: if L>1 then dec(L);

#77: if L<3 then inc(L);

end;{case}

#13: begin

stop:=true;

run_menu:=L;

end;

end;

run_menu:=L;

textbackground(0);

window(1,1,80,25);

end;

end;

function pop_menu1:byte;{работа с первым пунктом меню}

Var

stop:boolean;

Begin

window(1,1,80,25);

clrscr;

textcolor(15);

textbackground(11);

gotoxy(2,1); write(' Открыть ');

gotoxy(2,2); write(' Сохранить ');

textbackground(1);

textcolor(7);

stop:=false;

L:=1;

While not stop do

Begin

Case L of

Begin

gotoxy(2,1);

textbackground(4);

write(' Открыть ');

help_line(' Открыть файл данных');

end;

Begin

gotoxy(2,2);

textbackground(4);

write(' Сохранить ');

help_line(' Сохранить в файле ');

end;

end;

Case readkey of

#0: case readkey of

#72: if L<1 then inc(L);

#80: if L>2 then dec(L);

end;{case}

#13: begin

pop_menu1:=L;

stop:=true;

end;

#27: begin

pop_menu1:=L;

stop:=true;

end;

end;{case}

end;

pop_menu1:=L;

{ textbackground(0);}

window(1,1,80,25);

end;

function pop_menu2:byte;

Var

stop:boolean;

L:byte;

i:byte;

Begin

stop:=false;

L:=1;

While not stop do

Begin

textcolor(15);

textbackground(11);

gotoxy(12,1); write(' Ввод ');

gotoxy(12,2); write(' Показать ');

gotoxy(12,3); write(' Изменить ');

gotoxy(12,4); write(' Очистить ');

textbackground(1);

textcolor(7);


Понравилась статья? Добавь ее в закладку (CTRL+D) и не забудь поделиться с друзьями:  



double arrow
Сейчас читают про: