Пример #1
0
        static void Main(string[] args)
        {
            ////T01
            //Person pesho = new Person()
            //{
            //    Name = "Pesho",
            //    Age = 20
            //};


            //Console.WriteLine($"{pesho.Name} {pesho.Age}");

            //Console.WriteLine("---------------------------------------------");

            ////T02
            //var noName = new Person();
            //Console.WriteLine($"NoNameGuy: {noName.Name} {noName.Age}");
            //var gosho = new Person(24);
            //Console.WriteLine($"GoshoYear: {gosho.Name} {gosho.Age}");
            //var stamat = new Person("Stamat", 27);
            //Console.WriteLine($"Stamat: {stamat.Name} {stamat.Age}");

            int n      = int.Parse(Console.ReadLine());
            var family = new Family();

            for (int i = 0; i < n; i++)
            {
                var    cmdArgs = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);
                string name    = cmdArgs[0];
                int    age     = int.Parse(cmdArgs[1]);

                var person = new Person(name, age);
                family.AddMember(person);
            }

            //T03
            //Console.WriteLine(family.GetOldestMember());

            HashSet <Person> personAbove30 = family.GetAllPeopleOver30();

            Console.WriteLine(string.Join(Environment.NewLine, personAbove30));
        }
Пример #2
0
        static void Main(string[] args)
        {
            int inputCount = int.Parse(Console.ReadLine());

            Family family = new Family();

            for (int i = 0; i < inputCount; i++)
            {
                string[] what = Console.ReadLine().Split().ToArray();

                Person person = new Person(what[0], int.Parse(what[1]));

                family.AddMember(person);
            }

            //   Console.WriteLine(family.GetOldestMember());


            HashSet <Person> hmmm = family.GetAllPeopleOver30();

            Console.WriteLine(string.Join(Environment.NewLine, hmmm));
        }