Blame lazarus/calc/unit1.pas

637a62
unit Unit1;
637a62
637a62
{$mode objfpc}{$H+}
637a62
637a62
interface
637a62
637a62
uses
637a62
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
637a62
637a62
type
637a62
637a62
  { TForm1 }
637a62
637a62
  TForm1 = class(TForm)
637a62
    Button1: TButton;
637a62
    Button2: TButton;
637a62
    Button3: TButton;
637a62
    Button4: TButton;
637a62
    Edit1: TEdit;
637a62
    Edit2: TEdit;
637a62
    Edit3: TEdit;
637a62
    Memo1: TMemo;
637a62
    procedure Button1Click(Sender: TObject);
637a62
    procedure Button2Click(Sender: TObject);
637a62
    procedure Button3Click(Sender: TObject);
637a62
    procedure Button4Click(Sender: TObject);
637a62
  private
637a62
    { private declarations }
637a62
  public
637a62
    { public declarations }
637a62
  end;
637a62
637a62
var
637a62
  Form1: TForm1;
637a62
637a62
implementation
637a62
637a62
{$R *.lfm}
637a62
637a62
procedure TForm1.Button1Click(Sender: TObject);
637a62
var
637a62
  a, b, c: single;
637a62
begin
637a62
  a := StrToFloat(Edit1.Text);
637a62
  b := StrToFloat(Edit2.Text);
637a62
  c := a + b;
637a62
  Edit3.Text := FloatToStr(c);
637a62
  Memo1.Lines.Add(Edit1.Text + ' + ' + Edit2.Text + ' = ' + Edit3.Text);
637a62
end;
637a62
637a62
procedure TForm1.Button2Click(Sender: TObject);
637a62
var
637a62
  a, b, c: single;
637a62
begin
637a62
  a := StrToFloat(Edit1.Text);
637a62
  b := StrToFloat(Edit2.Text);
637a62
  c := a - b;
637a62
  Edit3.Text := FloatToStr(c);
637a62
  Memo1.Lines.Add(Edit1.Text + ' - ' + Edit2.Text + ' = ' + Edit3.Text);
637a62
end;
637a62
637a62
procedure TForm1.Button3Click(Sender: TObject);
637a62
var
637a62
  a, b, c: single;
637a62
begin
637a62
  a := StrToFloat(Edit1.Text);
637a62
  b := StrToFloat(Edit2.Text);
637a62
  c := a * b;
637a62
  Edit3.Text := FloatToStr(c);
637a62
  Memo1.Lines.Add(Edit1.Text + ' * ' + Edit2.Text + ' = ' + Edit3.Text);
637a62
end;
637a62
637a62
procedure TForm1.Button4Click(Sender: TObject);
637a62
var
637a62
  a, b, c: single;
637a62
begin
637a62
  a := StrToFloat(Edit1.Text);
637a62
  b := StrToFloat(Edit2.Text);
637a62
  c := a / b;
637a62
  Edit3.Text := FloatToStr(c);
637a62
  Memo1.Lines.Add(Edit1.Text + ' / ' + Edit2.Text + ' = ' + Edit3.Text);
637a62
end;
637a62
637a62
end.
637a62