Exemple #1
0
        public PS CHIA(PS t2)
        {
            PS t = new PS();

            t.ts = this.ts * t2.ms;
            t.ms = this.ms * t2.ts;
            return(t.Rutgon());
        }
Exemple #2
0
        public PS Hieu(PS t2)
        {
            PS t = new PS();

            t.ts = this.ts * t2.ms - t2.ts * this.ms;
            t.ms = this.ms * t2.ms;
            return(t);
        }
Exemple #3
0
        public PS Tong(PS t2)
        {
            PS t = new PS();

            t.ts = this.ts * t2.ms + t2.ts * this.ms;
            t.ms = this.ms * t2.ms;
            return(t.Rutgon());
        }
Exemple #4
0
        static void Main2()
        {
            PS t1 = new PS(4, 5);
            PS t2 = new PS(9, 10);

            Console.Write(" Tong 2 phan so la: ");
            PS t = t1.Tong(t2);

            t.Hien();
            Console.Write(" Hieu 2 phan so la: ");
            PS t3 = t1.Hieu(t2);

            t3.Hien();
            Console.Write(" Nhan 2 phan so bang: ");
            PS t4 = t1.Nhan(t2);

            t4.Hien();
            Console.Write(" chia 2 phan so bang: ");
            PS t5 = t1.CHIA(t2);

            t5.Hien();
            if (t1 == t2)
            {
                Console.WriteLine("Hai phan so bang nhau");
            }
            else
            {
                Console.WriteLine("Hai phan so khong bang nhau");
            }
            if (t1 > t2)
            {
                Console.WriteLine("t1>t2");
            }
            else
            {
                Console.WriteLine("t1<=t2");
            }
            Console.ReadKey();
        }
Exemple #5
0
 public PS(PS t2)
 {
     this.ts = t2.ts;
     this.ms = t2.ms;
 }