unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Edit1: TEdit;
    Edit2: TEdit;
    ComboBox1: TComboBox;
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Button2: TButton;
    SaveDialog1: TSaveDialog;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var dystans, paliwo, spalanie_na_100: single;
begin
  dystans:=StrtoFloat(Edit1.Text);
  paliwo:=StrtoFloat(Edit2.Text);
  Memo1.Lines.Add(Combobox1.Text);
  Memo1.Lines.Add('Liczba przejechanych km '+Edit1.Text);
  Memo1.Lines.Add('Spalono litrów '+Edit2.Text);
  spalanie_na_100:=paliwo*100/dystans;
  Memo1.Lines.Add('Spalanie na 100km wynosi '+FloattoStrF(spalanie_na_100,ffFixed,7,2));
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  if Savedialog1.Execute then Memo1.Lines.SaveToFile(Savedialog1.filename);
end;

end.
