
<a href='http://www.backline.ru/lazarus/' target='_blank'>http://www.backline.ru/lazarus/</a>
Но дальше все мои попытки заканчиваются неуспехом

Модератор: Модераторы
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
end;
initialization
{$I unit1.lrs}
end.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
a,b,c,D,x1,x2 : real;
implementation
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
a := StrToFloat(Edit1.Text);
b := StrToFloat(Edit2.Text);
c := StrToFloat(Edit3.Text);
D=b*b+4*a*c;
if D<0 then
label1.Caption := 'Нет корней!'
else
begin
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
end;
Label3.Caption := FloatToStr(x1);
Label4.Caption := FloatToStr(x2);
end;
initialization
{$I unit1.lrs}
end.
для начала книгу Никлауса Вирта
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 246