using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Structuri
{
    public struct Punct
    {
        //date membre
        private int _x, _y;

        //constructorul structurii
        public Punct(int _x, int _y)
        {
            this._x = _x;
            this._y = _y;
        }
           
        //proprietati 
        //----------------------------------------
        public int x
        {
            get
            {
                return _x;
            }

            set
            {
                _x = value;
            }
        }

        public int y
        {
            get
            {
                return _y;
            }

            set
            {
                _y = value;
            }
        }
        //----------------------------------------


        public string infoPunct()
        {
            return "(" + x + "," + y + ")";
        }
    }

   public struct Linie
    {
        //structura Linie are ca si date membre doua structuri de tip punct
        private Punct p1;
        private Punct p2;

        public Linie(Punct _p1, Punct _p2)
        {
            p1 = new Punct(_p1.x, _p1.y);
            p2 = new Punct(_p2.x, _p2.y);

        }

        public Punct x
        {
            get { return p1; }
        }

        public Punct y
        {
            get { return p2; }
        }

        public string infoLinie()
        {
            return p1.infoPunct() + " " + p2.infoPunct();
        }

    }

   public struct Dreptunghi
   {
       private Linie l1;
       private Linie l2;

       public Dreptunghi(Linie _l1, Linie _l2)
       {
           l1 = new Linie(_l1.x, _l1.y);
           l2 = new Linie(_l2.x, _l2.y);
       }

       public string infoDreptunghi()
       {
           return l1.infoLinie() + " " + l2.infoLinie();
       }
   }


    class Program
    {
        static void Main(string[] args)
        {
            int i;
                      
            //declarare si initializare
            Punct p = new Punct(2, 3);
            Console.WriteLine("p=" + p.infoPunct());

            p.x = 10;
            p.y = 20;
            Console.WriteLine("p=" + p.infoPunct());

            //declarare vector - structuri
            Punct[] parr = new Punct[10];
            for (i = 0; i < 10; i++)
                parr[i] = new Punct(i + 1, i + 1);

            //afisare vector - structuri
            for (i = 0; i < 10; i++)
                Console.WriteLine("parr[" + (i + 1) + "]=" + parr[i].infoPunct());


            //declarare si initializare
            Punct p1 = new Punct(1, 3);
            Punct p2 = new Punct(8, 11);
            Punct p3 = new Punct(4,6);
            Linie l1 = new Linie(p1, p2);
            Linie l2 = new Linie(p2,p3);
            Console.WriteLine("Linie: " + l1.infoLinie());

            //DREPRTUNGHI
            Dreptunghi d1 = new Dreptunghi(l1,l2);
            Console.WriteLine("Dreptunghi: " + d1.infoDreptunghi());

        }
    }
}
