Пример #1
0
Файл: Program.cs Проект: abvdu/-
        public static void Main(string[] args)
        {            
            var result = "";
            var day = 0;  
            var now = DateTime.Now;
            ListClass list = new ListClass();
            foreach (var item in list.InitialPersonList())
            {
                day = day + Math.Abs(((TimeSpan)(now - item.Birthday)).Days);
            }

            var avgday = day / list.InitialPersonList().Count;
            var avgYears = avgday / 365;
            var avgDays = avgday - avgYears * 365;

            result = "平均年龄:" + avgYears + "周岁" + "-" + avgDays + "天";
            Console.WriteLine(result);
            GetName(list.InitialPersonList());
        }