eLst
{: * Line; (); void Generate (int ACount); void LoadFromFile (char * FileName); void SaveToFile (char * FileName); SaveCrossedTria (char * FileName); void Filter () ; Boolean Cross (TLine * Item, TLine * SubItem); void SetBiggSmall (); void Repaint ();
}; Power (long X)
{(X * X);
}; GetLength (TPoint P1, TPoint P2)
{Result; = Power (P2.X - P1.X) + Power (P2.Y - P1.Y); (Result> 0) = sqrt (Result) ;//** * Інакше координати двох точок рівні = 0; (Result);
};
// *** TShape methodsTShape :: TShape (Byte ACol, int ATag)
{= ACol; = ATag;
}; TShape :: SetClr (Byte ACol)
{= ACol;
}; :: ~ TShape ()
{
// *** must be
};
// *** TLine methods :: TLine (TPoint AA, TPoint AB, Byte ACol, int ATag): TShape (ACol, ATag)
{= AA; = AB; = SetLen (); = False;
}; TLine :: SetLen ()
{(GetLength (A, B));
}; TLine :: Draw ()
{(Crossed) (YELLOW); (Color); (AX, AY, BX, BY);
};
// *** TTriangle methods :: TTriangle (TPoint AA, TPoint AB, TPoint AC, Byte ACol, int ATag): (ACol, ATag)
{= TLine (AA, AB, Color, 0); = TLine (AB, AC, Color, 0); = TLine (AC, AA, Color, 0); = False; = SetArea (); = False;
}; TTriangle :: SetArea ()
{P = A.Len + B.Len + C.Len; (sqrt (P * (PA.Len) * (PB.Len) * (PC.Len))); p>
}; TTriangle :: SetClr (Byte ACol)
{. SetClr (ACol);. SetClr (ACol);. SetClr (ACol);
}; TTriangle :: Draw ()
{(Crossed)
{. SetClr (YELLOW);. SetClr (YELLOW);. SetClr (YELLOW);
}; (Smaller)
{. SetClr (BLUE);. SetClr (BLUE);. SetClr (BLUE);
};. Draw ();. Draw ();. Draw ();
};
// *** TShapeLst methods :: TShapeLst (): TList ()
{= 0;
}; TShapeLst :: Repaint ()
{* Item; = (TShape *) FirstItem; (Item)
{> Draw (); = (TShape *) Item-> Next;
};
};
// *** TTrianlgeLst methods :: TTriangleLst (): TShapeLst ()
{
// *** must be
}; TTriangleLst :: Generate (int ACount)
{I; A, B, C; * T; (I = 1; I <= ACount; I + +)
{. X = 50 + random (450);. Y = 100 + random (200);. ...