unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMan;
type
TForm1 =
class(TForm)
ListBox1: TListBox;
Edit1: TEdit;
Button1: TButton;
XPManifest1: TXPManifest;
Button2: TButton;
Label1: TLabel;
Button3: TButton;
Label2: TLabel;
Edit2: TEdit;
ListBox2: TListBox;
procedure FormDestroy(Sender: TObject);
procedure Edit2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
type
feldtyp =
array[0..5000]
of integer;
var
Form1: TForm1;
f:feldtyp;
index:integer;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
index:=0;
if fileexists(edit2.text+'
.array')
then
listbox1.items.loadfromfile(edit2.text+'
.array');
if fileexists('
settings.ini')
then
listbox2.items.loadfromfile('
settings.ini');
edit2.Text:=listbox2.items.strings[listbox2.itemindex];
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
f[
index]:=strtoint(edit1.text);
listbox1.items.add(edit1.Text);
edit1.text:='
';
label1.caption:='
Bis jetzt wurden '+inttostr(
index+1)+'
Zahlen aufgenommen.';
index:=index+1;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
a,i,j:integer;
begin
for i:=1
to index do
begin
for j:=
index downto i
do
begin
if f[j] < f[j-1]
then
begin
a := f[j-1];
f[j-1] :=f[j];
f[j] := a;
end;
end;
end;
listbox1.Items.clear;
for i:=1
to index do begin
listbox1.items.add(inttostr(f[i]));
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
listbox1.items.Clear;
label1.caption:='
Bis jetzt wurden 0 Zahlen aufgenommen.';
index:=0;
end;
procedure TForm1.Edit2Click(Sender: TObject);
begin
edit2.Text:='
';
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
listbox1.Items.savetofile(edit2.Text+'
.array');
listbox2.Items.clear;
listbox2.Items.add(edit2.Text);
listbox2.items.SaveToFile('
settings.ini');
end;
end.