ex4.pp 536 B

12345678910111213141516171819202122232425
  1. Program ex4;
  2. { Program to demonstrate TRect.Intersect }
  3. Uses objects;
  4. Var ARect,BRect,CRect : TRect;
  5. begin
  6. ARect.Assign(10,10,20,20);
  7. BRect.Assign(15,15,25,25);
  8. { CRect is intersection of ARect and BRect }
  9. CRect.Assign(15,15,20,20);
  10. { Calculate it explicitly}
  11. ARect.Intersect(BRect);
  12. If ARect.Equals(CRect) Then
  13. Writeln ('ARect equals CRect')
  14. Else
  15. Writeln ('ARect does not equal CRect !');
  16. BRect.Assign(25,25,30,30);
  17. Arect.Intersect(BRect);
  18. If ARect.Empty Then
  19. Writeln ('ARect is empty');
  20. end.