Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.InputEncoding  = Encoding.UTF8;
            Console.OutputEncoding = Encoding.UTF8;
            PS t = new PS();

            t.nhap(); t.hien();
            PS t2 = new PS();

            t2.nhap(); t2.hien();
            PS t3 = t + t2; t3.hien();
            PS t4 = t * t2; t4.hien();

            if (t > t2)
            {
                Console.WriteLine("Phân số t1 > t2");
            }
            else if (t < t2)
            {
                Console.WriteLine("Phân số t1 < t2");
            }
            else
            {
                Console.WriteLine("Hai phân số = nhau");
            }
            Console.ReadKey();
        }
Exemplo n.º 2
0
        public static PS operator *(PS t1, PS t2)
        {
            PS t = new PS();

            t.tu  = t1.tu * t2.tu;
            t.mau = t1.mau * t2.mau;
            return(t);
        }