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

interface

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

type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
BitBtn1: TBitBtn;
StringGrid1: TStringGrid;
Label2: TLabel;
StringGrid2: TStringGrid;
Label3: TLabel;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
A:array of char;
N,M,i,j:integer;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
N:=5; Edit1.Text:=inttostr(N);
StringGrid1.ColCount:=N;
StringGrid2.ColCount:=N;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
N:=StrToInt(Edit1.Text);
StringGrid1.ColCount:=N;
StringGrid2.ColCount:=N;
end;

procedure TForm1.Button2Click(Sender: TObject);
var k:integer;
t:char;
begin
SetLength(a,n+1);
for i:=1 to N do
A[i]:=StringGrid1.Cells[i-1,0][1];

i:=1;
while i<=n do
begin
for j:=1 to i do if a[i]=a[j] then break;
if j<>i then
begin
for j:=i+1 to n do a[j-1]:=a[j];
dec(n);
dec(i);
end;
inc(i);
end;

StringGrid2.ColCount:=N;
for i:=1 to n do stringgrid2.cells[i-1,0]:=a[i];
a:=nil;
end;

end.

Соседние файлы в папке 5.13
  • #
    15.06.2014188 б6Project1.dpr
  • #
    15.06.2014876 б5Project1.res
  • #
    15.06.20145.81 Кб6Unit1.dcu
  • #
    15.06.201451 б5Unit1.ddp
  • #
    15.06.20144.04 Кб5Unit1.dfm
  • #
    15.06.20141.5 Кб5Unit1.pas