Larazus开发计算器

来源:互联网 发布:淘宝lol账号交易平台 编辑:程序博客网 时间:2024/05/01 12:57
unit Unit1;{$mode objfpc}{$H+}interfaceuses  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,Math;type  { TForm1 }  TForm1 = class(TForm)    Button1: TButton;    Edit1: TEdit;    Edit2: TEdit;    Edit3: TEdit;    RadioButton1: TRadioButton;    RadioButton2: TRadioButton;    RadioButton3: TRadioButton;    RadioButton4: TRadioButton;    procedure Button1Click(Sender: TObject);  private    { private declarations }  public    { public declarations }  end;var  Form1: TForm1;implementation{$R *.lfm}{ TForm1 }procedure TForm1.Button1Click(Sender: TObject);var  a,b,c:double;  result:string;begin  val(edit1.Text,a);  val(edit2.Text,b);  if radiobutton1.Checked=true then  begin    c:=a+b  end;  if radiobutton2.Checked=true then  begin    c:=a-b  end;  if radiobutton3.Checked=true then  begin    c:=a*b  end;  if radiobutton4.Checked=true then  begin    c:=a/b  end;  result:=formatfloat('0.00',c);  //str(c,result);  edit3.Text:=result;end;end.

0 0