Пример #1
0
        static void Main(string[] args)
        {
            Family people = new Family();

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string[] tokens = Console.ReadLine().Split().ToArray();
                string   name   = tokens[0];
                int      age    = int.Parse(tokens[1]);

                Person person = new Person(name, age);

                people.AddMember(person);
            }

            StringBuilder result = new StringBuilder();


            foreach (var person in people.GetPeople())
            {
                result.AppendLine($"{person.Name} - {person.Age}");
            }

            Console.WriteLine(result.ToString());
        }
Пример #2
0
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            Family family = new Family();

            for (int i = 0; i < n; i++)
            {
                string[] input = Console.ReadLine().Split(' ').ToArray();

                string name = input[0];
                int    age  = int.Parse(input[1]);

                Person person = new Person(name, age);

                family.AddMember(person);
            }

            Person[] people = family.GetPeople();

            foreach (var person in people)
            {
                Console.WriteLine($"{person.Name} - {person.Age}");
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            int    n      = int.Parse(Console.ReadLine());
            Family family = new Family();

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

                Person person = new Person(age, name);

                family.AddMember(person);
            }

            Person[] resultArray = family.GetPeople();

            foreach (var item in resultArray)
            {
                Console.WriteLine(item.Name + " - " + item.Age);
            }
        }
Пример #4
0
        public static void Main(string[] args)
        {
            int    n      = int.Parse(Console.ReadLine());
            Family family = new Family();

            for (int i = 0; i < n; i++)
            {
                string[] input = Console.ReadLine().Split();

                Person person = new Person(input[0], int.Parse(input[1]));
                family.AddMember(person);
            }
            Person[] people = family.GetPeople();
            foreach (var item in people)
            {
                Console.WriteLine($"{item.Name} - {item.Age}");
            }



            //Person person = new Person();
            //Person person1 = new Person(12);
            //Person person2 = new Person("pesho", 21);



            //Person person = new Person("Pesho", 20);
            //Console.WriteLine($"{person.Name} {person.Age}");
            //Person person1 = new Person();
            //person1.Name = "Gosho";
            //person1.Age = 18;
            //Console.WriteLine($"{person1.Name} {person1.Age}");
            //Person person2 = new Person();
            //person2.Name = "Stamat";
            //person2.Age = 43;
            //Console.WriteLine($"{person2.Name} {person2.Age}");
        }
Пример #5
0
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            Family family = new Family();

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

                Person person = new Person(name, age);

                family.AddMember(person);
            }

            Person[] oldestPerson = family.GetPeople();

            foreach (var person in oldestPerson)
            {
                Console.WriteLine($"{person.Name} - {person.Age}");
            }
        }
Пример #6
0
        public static void Main(string[] args)
        {
            //Person pesho = new Person("Pesho", 20);
            //Console.WriteLine($"{pesho.Name} {pesho.Age}");

            //Person gosho = new Person("Gosho", 18);
            //Console.WriteLine($"{gosho.Name} {gosho.Age}");

            //Person stamat = new Person("Stamat", 43);
            //Console.WriteLine($"{stamat.Name} {stamat.Age}");

            //Person person1 = new Person();
            //Person person2 = new Person(12);
            //Person person3 = new Person("Stoyan", 24);

            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 person = new Person(name, age);
                family.AddMember(person);
            }

            //Person oldestPerson = family.GetOldestMember();
            Person[] people = family.GetPeople();
            foreach (var person in people)
            {
                Console.WriteLine($"{person.Name} - {person.Age}");
            }
        }