unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Button2: TButton;
Label3: TLabel;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var a,b,c: Integer;
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
randomize;
a:= random(1001);
b:= random(1001);
Label1.Caption :=inttostr
(a);
Label2.Caption :=inttostr
(b);
form1.color:= clgreen;
Label3.Caption:= '
0';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Label3.caption:= inttostr(a+b);
If Strtoint(Label3.Caption)>500
then begin
Form1.Color:= clred;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Label3.caption:= inttostr(a-b);
If Strtoint(Label3.Caption)>500
then begin
Form1.Color:= clred;
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Label3.caption:= inttostr(a*b);
If Strtoint(Label3.Caption)>500
then begin
Form1.Color:= clred;
end;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Label3.caption:= inttostr(a
div b);
Label4.caption:= inttostr(a
mod b);
end;
procedure TForm1.Button5Click(Sender: TObject);
var a,b: real;
begin
Label3.caption:= floattostr(a-b);
If Strtofloat(Label3.Caption)>500
then begin
Form1.Color:= clred;
end;
end;