unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var a,b,c:Real;
begin
randomize;
Form1.Color:=random(255*255*255);
a:=strtofloat(Edit1.Text);
b:=strtofloat(Edit2.Text);
c:=a+b;
Label1.caption:=floattostr(c);
If c=10
then begin
Form1.Color:=clred;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var a,b,c:Real;
begin
randomize;
Form1.Color:=random(255*255*255);
a:=strtofloat(Edit1.Text);
b:=strtofloat(Edit2.Text);
c:=a-b;
Label1.caption:=floattostr(c);
If c=10
then begin
Form1.Color:=clgreen;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
var a,b,c:Real;
begin
randomize;
Form1.Color:=random(255*255*255);
a:=strtofloat(Edit1.Text);
b:=strtofloat(Edit2.Text);
c:=a*b;
Label1.caption:=floattostr(c);
If c=25
then begin
Form1.Color:=clyellow;
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
var a,b,c:Real;
begin
randomize;
Form1.Color:=random(255*255*255);
a:=strtofloat(Edit1.Text);
b:=strtofloat(Edit2.Text);
c:=a/b;
Label1.caption:=floattostr(c);
If c=5
then begin
Form1.Color:=clblue;
end;
end;
end.