您的位置:首页 > 其它

Larazus开发计算器

2015-10-13 16:53 260 查看
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
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.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: