public static void Main() { var peopleCount = int.Parse(Console.ReadLine()); var family = new Family(); for (var i = 0; i < peopleCount; i++) { var args = Console.ReadLine().Split(); var person = new Person(int.Parse(args[1]), args[0]); family.AddMembers(person); } Console.WriteLine(family.GetOldestMember().ToString()); }
static void Main() { int n = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < n; i++) { string[] input = Console.ReadLine().Split(); string name = input[0]; int age = int.Parse(input[1]); Person newPerson = new Person(name, age); family.AddMembers(newPerson); } Console.WriteLine($"{family.GetOldestMember().Name} {family.GetOldestMember().Age}"); }
static void OldestFamilyMember() { int n = int.Parse(Console.ReadLine()); Family family = new Family(); for (int a = 0; a < n; a++) { string[] input = Console.ReadLine().Split(); string name = input[0]; int age = int.Parse(input[1]); Person person = new Person(name, age); family.AddMembers(person); } Console.WriteLine(family.GetOldestMember()); }