unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
type
Time = record
h: 0 .. 23;
m, s: 0 .. 59 end;
var
t_1: Time;
t_2: Time;
function Earlier(T1, T2: Time): Boolean;
begin
if T1.h <> T2.h then
Result := T1.h < T2.h
else if T1.m <> T2.m then
Result := T1.m < T2.m
else if T1.s <> T2.s then
Result := T1.s < T2.s
end;
begin
t_1.h := StrToInt(Edit1.Text);
t_1.m := StrToInt(Edit2.Text);
t_1.s := StrToInt(Edit3.Text);
t_2.h := StrToInt(Edit4.Text);
t_2.m := StrToInt(Edit5.Text);
t_2.s := StrToInt(Edit6.Text);
ShowMessage('t_1 раньше, чем t_2 : ' + BoolToStr(Earlier(t_1,
t_2), True));
end;
end.