1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
type Tinterval=record
min,max:extended;
end;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Déclarations privées }
int1,int2:Tinterval;
function union(i1,i2:Tinterval):Tinterval;
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
with int1 do begin
min:=2.1;
max:=4.5;
end;
with int2 do begin
min:=1.1;
max:=3.3;
end;
caption:='l''intervalle union est['+ floattostr(union(int1,int2).min)+' , '+ floattostr(union(int1,int2).max)+' ]';
end;
function Tform1.union(i1,i2:Tinterval):Tinterval;
begin
if i1.min<i2.min then result.min:=i1.min else result.min:=i2.min;
if i1.max>i2.max then result.max:=i1.max else result.max:=i2.max;
end;
end. |
Partager