コード例 #1
0
        public static void Main()
        {
            string inputLine = Console.ReadLine();

            List <Box> boxes = new List <Box>();

            while (!inputLine.Equals("end"))
            {
                string[] inputTokens = inputLine.Split(new[] { ':', ' ', '|' }, StringSplitOptions.RemoveEmptyEntries);

                boxes.Add(boxParse(inputTokens));

                inputLine = Console.ReadLine();
            }

            foreach (var box in boxes)
            {
                Console.WriteLine("Box: {0}, {1}", box.width, box.height);
                Console.WriteLine("Perimeter: " + Box.calculatePerimeter(box.width, box.height));
                Console.WriteLine("Area: " + Box.calculateArea(box.width, box.height));
            }
        }