unit FibuU;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Borland.Vcl.StdCtrls, Borland.Vcl.ExtCtrls,
System.ComponentModel;
type
TForm1 =
class(TForm)
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
ListBox1: TListBox;
Label3: TLabel;
Button2: TButton;
Button3: TButton;
ComboBox1: TComboBox;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.nfm}
procedure TForm1.Button1Click(Sender: TObject);
var fibo:
array[1..50]
of longint;
auswahl:integer;
i:integer;
Begin
auswahl := StrToIntDef(ComboBox1.Text,auswahl);
ComboBox1.Text := IntToStr(auswahl);
ListBox1.Items.Clear;
fibo[1]:=StrToInt(edit1.text);
fibo[2]:=StrToInt(edit2.text);
for i:=3
to 50
do
Begin
fibo[i]:=fibo[i-1]+fibo[i-2];
end;
for i:=1
to auswahl
do
Begin
listbox1.Items.Add(IntToStr(fibo[i]));
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
ListBox1.Items.Clear;
end;
end.