static void Main(string[] args) { int numberOfPeople = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < numberOfPeople; i++) { string[] input = Console.ReadLine().Split(" "); string name = input[0]; int age = int.Parse(input[1]); family.AddMember(new Person(name, age)); } Person oldestMember = family.GetOldestMember(); Console.WriteLine($"{oldestMember.Name} {oldestMember.Age}"); }
static void Main(string[] args) { int numberOfPeople = int.Parse(Console.ReadLine()); Family newFamily = new Family() { People = new List <Person>() }; for (int i = 0; i < numberOfPeople; i++) { string[] personInfo = Console.ReadLine().Split(); string name = personInfo[0]; int age = int.Parse(personInfo[1]); Person onePerson = new Person(name, age); newFamily.AddMember(onePerson); } Person oldestMember = newFamily.GetOldestMember(); Console.WriteLine($"{oldestMember.Name} {oldestMember.Age}"); }
static void Main(string[] args) { int numberLines = int.Parse(Console.ReadLine()); Family myFamily = new Family(); for (int i = 0; i < numberLines; i++) { List <string> personInfo = Console.ReadLine().Split(' ').ToList(); string name = personInfo[0]; int age = int.Parse(personInfo[1]); Person newPerson = new Person(name, age); myFamily.AddMember(newPerson); } Person oldestPerson = myFamily.GetOldestMember(); Console.WriteLine($"{oldestPerson.Name} {oldestPerson.Age}"); }
static void Main() { int numOfPeople = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < numOfPeople; i++) { string[] personData = Console.ReadLine().Split(' '); string name = personData[0]; int age = int.Parse(personData[1]); Person person = new Person(name, age); family.AddMember(person); } Person oldestMember = family.GetOldestMember(); Console.WriteLine(oldestMember); }