Скачиваний:
13
Добавлен:
15.06.2014
Размер:
2.76 Кб
Скачать
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, ComCtrls,Unit3, StdCtrls, Buttons;

type
TForm1 = class(TForm)
TreeView1: TTreeView;
StringGrid1: TStringGrid;
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Edit1: TEdit;
BitBtn1: TBitBtn;
Button4: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
a:mas;
i,n,kol:integer;
p,root:ptree;
sitem:string;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
n:=11;
kol:=n-1;
stringGrid1.RowCount:=n;
stringGrid1.Cells[0,1]:='Петров';
stringGrid1.Cells[1,1]:=IntTostr(100);
stringGrid1.Cells[0,2]:='Сидоров';
stringGrid1.Cells[1,2]:=IntTostr(105);
stringGrid1.Cells[0,3]:='Козлов';
stringGrid1.Cells[1,3]:=IntTostr(95);
stringGrid1.Cells[0,4]:='Иванов';
stringGrid1.Cells[1,4]:=IntTostr(99);
stringGrid1.Cells[0,5]:='Пуговкин';
stringGrid1.Cells[1,5]:=IntTostr(108);
stringGrid1.Cells[0,6]:='Антонов';
stringGrid1.Cells[1,6]:=IntTostr(110);
stringGrid1.Cells[0,7]:='Пушкин';
stringGrid1.Cells[1,7]:=IntTostr(90);
stringGrid1.Cells[0,8]:='Кукушкин';
stringGrid1.Cells[1,8]:=IntTostr(94);
stringGrid1.Cells[0,9]:='Кузьмин';
stringGrid1.Cells[1,9]:=IntTostr(91);
stringGrid1.Cells[0,10]:='Андропов';
stringGrid1.Cells[1,10]:=IntTostr(96);

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
root:= nil;
for i:=1 to kol do begin
a[i].s:=stringGrid1.Cells[0,i];
a[i].key:= StrToInt(stringGrid1.Cells[1,i]);
end;
MakeB(a,kol,root);
view(TreeView1,root);

end;

procedure TForm1.Button2Click(Sender: TObject);
var kl:integer;
begin
kl:=StrToInt(Edit1.Text);
Memo1.Clear;
sitem:='';
FindK(root,kl,sitem);
if length(sitem)>0 then
Memo1.Lines.Add(sitem)
else
Memo1.Lines.Add('такого нет!');


end;

procedure TForm1.Button3Click(Sender: TObject);
begin
Memo1.Clear;
if root=nil then Memo1.lines.add('дерево пустое!')
else
Read(root,Memo1);

end;

procedure TForm1.Button4Click(Sender: TObject);
begin
kol:=0;
FindA(root,kol);
Memo1.Clear;
memo1.Lines.Add('с буквы А начинается '+intTostr(kol)+' фамилий.');
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
delett(root);
end;

end.
Соседние файлы в папке кол-во фамилий с буквы а
  • #
    15.06.2014876 б13Project1.res
  • #
    15.06.2014213 б14Project1.~dpr
  • #
    15.06.20147.59 Кб13Unit1.dcu
  • #
    15.06.201451 б13Unit1.ddp
  • #
    15.06.20142.1 Кб13Unit1.dfm
  • #
    15.06.20142.76 Кб13Unit1.pas
  • #
    15.06.20142.07 Кб13Unit1.~dfm
  • #
    15.06.20142.63 Кб13Unit1.~pas
  • #
    15.06.20141.64 Кб13Unit2.dcu
  • #
    15.06.20141.36 Кб13Unit2.pas
  • #
    15.06.20141.35 Кб13Unit2.~pas