示例#1
0
        static void Main2(string[] args)
        {
            PS t1 = new PS();
            PS t2 = new PS();

            Console.WriteLine("Tong hai phan so");
            PS tong = t1.Tong(t2);

            tong.Hien();
            Console.WriteLine("Hieu hai phan so");
            PS hieu = t1.Hieu(t2);

            hieu.Hien();
            Console.WriteLine("Tich hai phan so");
            PS tich = t1.Tich(t2);

            tich.Hien();
            Console.WriteLine("Thuong hai phan so");
            PS thuong = t1.Thuong(t2);

            thuong.Hien();
            if (t1 > t2)
            {
                Console.WriteLine("t1>t2");
            }
            else
            {
                Console.WriteLine("t1<=t2");
            }
            Console.ReadKey();
        }
示例#2
0
        //Quy đồng
        public static PS operator +(PS t1, PS t2)
        {
            PS t = new PS();

            t.ts = t1.ts * t2.ms + t1.ms * t2.ts;
            t.ms = t1.ms * t2.ms;
            return(t.Rutgon());
        }
示例#3
0
 //Thương
 public PS Thuong(PS t2)
 {
     ts = this.ts * t2.ms;
     ms = this.ms * t2.ts;
     return(Rutgon());
 }
示例#4
0
 //Hiệu
 public PS Hieu(PS t2)
 {
     ts = this.ts * t2.ms - this.ms * t2.ts;
     ms = this.ms * t2.ms;
     return(Rutgon());
 }