static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < n; i++) { string[] personArgs = Console.ReadLine() .Split(' ', StringSplitOptions.RemoveEmptyEntries) .ToArray(); string name = personArgs[0]; int age = int.Parse(personArgs[1]); Person person = new Person(age, name); family.AddMember(person); } HashSet <Person> result = family.GetAllPeopleAbove30(); Console.WriteLine(String.Join(Environment.NewLine, result)); }
public static void Main() { Family family = new Family(); int membersCount = int.Parse(Console.ReadLine()); try { for (int i = 0; i < membersCount; i++) { string[] personArgs = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries) .ToArray(); string name = personArgs[0]; int age = int.Parse(personArgs[1]); Person person = new Person(name, age); family.AddMember(person); } HashSet <Person> result = family.GetAllPeopleAbove30(); Console.WriteLine(string.Join(Environment.NewLine, result)); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
static void Main(string[] args) { Family family = new Family(); int n = int.Parse(Console.ReadLine()); while (n-- > 0) { string[] personData = Console.ReadLine().Split(); string name = personData[0]; int age = int.Parse(personData[1]); family.AddMember(new Person(name, age)); } HashSet <Person> result = family.GetAllPeopleAbove30(); Console.WriteLine(string.Join(Environment.NewLine, result)); }
static void Main(string[] args) { Family family = new Family(); int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string[] personArgs = Console.ReadLine().Split(); string name = personArgs[0]; int age = int.Parse(personArgs[1]); Person person = new Person(name, age); family.AddMember(person); } HashSet <Person> result = family.GetAllPeopleAbove30(); Console.WriteLine(string.Join(Environment.NewLine, result)); }