static void Main(string[] args) { SortedTriangleContainer triangles = UI.GetTriangles(); triangles.OrderByDescending(); UI.PrintTriangles(triangles); Console.ReadLine(); }
public static SortedTriangleContainer GetTriangles() { string userAnswer = "y"; SortedTriangleContainer triangles = new SortedTriangleContainer(); while (userAnswer == "y" || userAnswer == "yes") { Triangle currentTriangle = GetNewTriangle(); if (currentTriangle != null) { triangles.Add(currentTriangle); } Console.WriteLine("Do you want to continue (y/yes)?"); userAnswer = Console.ReadLine().ToLower(); } return(triangles); }
public static void PrintTriangles(SortedTriangleContainer triangles) { Console.WriteLine(triangles.ToString()); }