unit MainForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Math;
type
TForm1 = class(TForm)
CalculateButton: TButton;
ResultLabel: TLabel;
ResultEdit: TEdit;
procedure CalculateButtonClick(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.CalculateButtonClick(Sender: TObject);
var
a, b, c, Q: Double;
begin
a := 1;
b := 2;
c := 3;
Q := (6 * a + Power(b, 2)) / (Sqrt(Power(c, 2) - b) + Sin(Power(b, 2)));
ResultEdit.Text := FormatFloat('0.00', Q);
end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then // Обработка клавиши Enter
CalculateButtonClick(Sender);
end;
end.
Результат вывести в текстовое поле на форме и округлить до 2 знаков после запятой; (2