unit1.pas

来自「计算三角形的面积」· PAS 代码 · 共 48 行

PAS
48
字号
unit unit1;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit3: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Edit4: TEdit;
    Label3: TLabel;
    Button1: TButton;
    Edit2: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
  var a,b,x,s:real;
begin
  a:=strtofloat(edit1.Text);
  edit1.SetFocus;
  b:=strtofloat(edit2.Text);
  edit2.SetFocus;
  x:=strtofloat(edit3.Text);
  edit3.SetFocus;

  s:=a*b/2*sin(x*pi/180);
  edit4.Text:=floattostr(s);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?