unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QStdCtrls,StdCtrls, Buttons;
type
TForm1 = class(TForm)
BitBtn1: TButton;
BitBtn2: TButton;
procedure BitBtn1OnClick(Sender: TObject);
procedure BitBtn2OnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
BitBtn1, BitBtn2 : TButton;
Edit1, Edit2, Edit3: TEdit;
Label1, Label2, Label3, Label4, Label5,Label6,Label7,Label8: TLabel;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Edit1:= TEdit.Create(form1);
with edit1 do
begin
Parent:=form1;
Left:=180;
Top:=40;
end;
Label1:=Tlabel.Create(Form1);
with Label1 do
begin
Parent:=Form1;
Left:=80;
Top:=45;
Caption:='Задайте число A:';
end;
Edit2:= TEdit.Create(form1);
with edit2 do
begin
Parent:=form1;
Left:=180;
Top:=80;
end;
Label2:=Tlabel.Create(Form1);
with Label2 do
begin
Parent:=Form1;
Left:=80;
Top:=85;
Caption:='Задайте число B:';
end;
Edit3:= TEdit.Create(form1);
with edit3 do
begin
Parent:=form1;
Left:=180;
Top:=120;
end;
Label3:=Tlabel.Create(Form1);
with Label3 do
begin
Parent:=Form1;
Left:=80;
Top:=125;
Caption:='Задайте число C:';
end;
Label4:=Tlabel.Create(Form1);
with Label4 do
begin
Parent:=Form1;
Left:=50;
Top:=10;
Caption:='Программа вычисляет дискриминант квадратного уравнения';
end;
Label5:=Tlabel.Create(Form1);
with Label5 do
begin
Parent:=Form1;
Left:=80;
Top:=160;
end;
Label6:=Tlabel.Create(Form1);
with Label6 do
begin
Parent:=Form1;
Left:=80;
Top:=180;
end;
Label7:=Tlabel.Create(Form1);
with Label7 do
begin
Parent:=Form1;
Left:=80;
Top:=200;
end;
Label8:=Tlabel.Create(Form1);
with Label8 do
begin
Parent:=Form1;
Left:=80;
Top:=220;
end;
BitBtn1:=TBitBtn.Create(Form1);
with BitBtn1 do
begin
Parent:=Form1;
Left:=324;
Top:=40;
caption:='Вычислить';
end;
BitBtn2:=TBitBtn.Create(Form1);
with BitBtn2 do
begin
Parent:=Form1;
Left:=324;
Top:=80;
caption:='Выход';
end;
end;
procedure TForm1.BitBtn1OnClick(Sender: TObject);
var
a,b,c:real;
d:real;
begin
Label5.Caption := 'A: '+Edit1.Text;
Label6.Caption := 'B: '+Edit2.Text;
Label7.Caption := 'C: '+Edit3.Text;
a:= StrToFloat(Edit1.Text);
b:= StrToFloat(Edit2.Text);
c:= StrToFloat(Edit3.Text);
d:=sqr(b)-4*a*c;
label8.Caption := 'Результат: ' + FloatToStr(d);
end;
procedure TForm1.BitBtn2OnClick(Sender: TObject);
begin
Form1.Close;
end;
end.
Проблема выполнения кнопки, Не работает :( |