static void Main(string[] args) { try { Console.WriteLine("请输入你所要求的图形的英文名称:"); IChart chart = ChartFactory.GetChart(Console.ReadLine()); chart.display(); } catch { Console.WriteLine("请输入标准"); } }
static void Main(string[] args) { Chart chart_1 = ChartFactory.GetChart("triangle"); chart_1.display(); Chart chart_2 = ChartFactory.GetChart("circle"); chart_2.display(); Chart chart_3 = ChartFactory.GetChart("square"); chart_3.display(); Chart chart_4 = ChartFactory.GetChart("rectangle"); chart_4.display(); }