static void Main(string[] args) { Console.WriteLine("请输入:\"圆\"、\"正方形\"、\"三角形\"或者\"长方形\"。"); string type = Console.ReadLine(); Graph shape = GraphFactory.createGraph(type); Console.WriteLine(shape.GraphShow()); }
static void Main(string[] args) { Console.WriteLine("请输入你所要创建图形的序号:(1.三角形 2.圆形 3.正方形 4.长方形)"); int n; n = Convert.ToInt32(Console.ReadLine()); Graph shape; shape = GraphFactory.createGraph(n); shape.Init(); shape.Getarea(); Console.ReadKey(); }
static public Graph CreateYourGraph() { Console.Write("请输入你要创建的图形名字:"); Graph aGraph = GraphFactory.CreateGraph(Console.ReadLine()); if (aGraph == null) { CreateYourGraph(); } else { aGraph.InputDate(); aGraph.ShowArea(); } return(aGraph); }