unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Math;
type
TForm1 =
class(TForm)
LabeledEdit1: TLabeledEdit;
LabeledEdit2: TLabeledEdit;
LabeledEdit3: TLabeledEdit;
LabeledEdit4: TLabeledEdit;
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
var op: integer;
//Variable für den Ergebniswert
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var a,b,x,y: real;
// <-- hier sagt der compiler das o.g.
begin
Edit1.Clear;
op := 0;
//Operator = 0
// Werte von den Edit-Feldern holen und den Variablen zuweisen
a := strtofloat(labelededit3.text);
b := strtofloat(labelededit2.text);
x := strtofloat(labelededit4.text);
y := strtofloat(labelededit1.text);
// RadioBox-click feststellen und Formel feststellen.
if RadioButton1.checked
then op := 1;
if RadioButton2.checked
then op := 2;
if RadioButton3.checked
then op := 3;
if RadioButton4.checked
then op := 4;
// Lasset uns Rechen
if op = 1
then Edit1.text := FloatToStr(b * a * Power(a,x));
if op = 2
then Edit1.text := FloatToStr(y / Power(a,x));
if op = 3
then Edit1.text := FloatToStr(power((y/b), 1/x));
if op = 4
then Edit1.text := FloatToStr(ln(y/b)/ln(a));
end;
end.