Beispiel #1
0
        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());
            var femily = new Family(new List<Person>());
            for (int i = 0; i < num; i++)
            {
                string[] input = Console.ReadLine().Split(new[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                string name = input[0];
                int age = int.Parse(input[1]);
                var person = new Person(name, age);

                femily.AddMember(person);
            }
            var res = femily.familyMembers.OrderByDescending(x => x.age).First();
            Console.WriteLine(res.name+ " " +res.age);
        }
Beispiel #2
0
 public void AddMember(Person member)
 {
     familyMembers.Add(member);
 }