Delphi



- , .

1. .

2.      : Label, Edit, Button.

 

 


3.      , .

procedure TForm1.FormCreate(Sender: TObject);

begin

Edit1.Text := '';

Edit2.Text := '';

Edit3.Text := '';

end;

procedure TForm1.Button5Click(Sender: TObject);

begin

Edit1.Text := '';

Edit2.Text := '';

Edit3.Text := '';

end;

procedure TForm1.Button6Click(Sender: TObject);

begin

close;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

a := StrToFloat (Edit1.Text);

b := StrToFloat (Edit2.Text);

c := a + b;

Edit3.Text := FloatToStr (c);

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

a := StrToFloat (Edit1.Text);

b := StrToFloat (Edit2.Text);

c := a - b;

Edit3.Text := FloatToStr (c);

end;

procedure TForm1.Button3Click(Sender: TObject);

begin

a := StrToFloat (Edit1.Text);

b := StrToFloat (Edit2.Text);

c := a * b;

Edit3.Text := FloatToStr (c);

end;

procedure TForm1.Button4Click(Sender: TObject);

begin

a := StrToFloat (Edit1.Text);

b := StrToFloat (Edit2.Text);

if b = 0 then Edit3.Text := 'division by zero'

else

begin

c := a / b;

Edit3.Text := FloatToStr (c);

end;

end;

 

1.            , .

 

 


( Cos(x))

if Edit1.Text <> '' then

begin

a := StrToFloat (Edit1.Text);

c := cos (a);

end;

if Edit2.Text <> '' then

begin

b := StrToFloat (Edit2.Text);

c := cos (b);

end;

Edit3.Text := FloatToStr (c);

Tg(x), Log ab.

2.            , .