unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label4: TLabel;
    Button1: TButton;
    CheckBox1: TCheckBox;
    RadioGroup1: TRadioGroup;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.FormCreate(Sender: TObject);
begin
  Edit1.text:='';
  Edit2.text:='';
  Memo1.Clear;
  Memo1.Lines.Add('Рез-ты ст. гр. 722402 Борисок В.В.');
  RadioGroup1.ItemIndex:=0;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  x,y,c,u:extended;
begin
  try
    x:=StrToFloat(Edit1.Text);
    y:=StrToFloat(Edit2.Text);
  except
    on EConvertError do Exit;
  end;

  Memo1.Lines.Add(' x='+FloatToStrF(x,ffFixed,8,4));
  Memo1.Lines.Add(' y='+FloatToStrF(y,ffFixed,8,4));

  u := 0;
  case RadioGroup1.ItemIndex of
    0: u:=cos(x);
    1: u:=sqr(x);
    2: u:=exp(x);
  end;
  if((x-y)=0) then
  begin
    c:=u*u+y*y+sin(y);
  end else
  if((x-y)>0)then
  begin
    c:=sqr(u-y)+cos(y);
  end else
  begin
    c:=sqr(y-u)+tan(y);
  end;
  if CheckBox1.Checked then
    Memo1.Lines.Add('c='+IntToStr(round(c)))
    else
    Memo1.Lines.Add('c='+FloatToStrF(c,ffGeneral,8,2));
end;
end.
