Esempio n. 1
0
        static void Main()
        {
            PS t1 = new PS();

            Console.WriteLine(" nhap phan so t1");
            t1.nhap();
            t1.hien();
            PS t2 = new PS();

            Console.WriteLine(" nhap phan so t2");
            t2.nhap(); t2.hien();
            Console.WriteLine("Tong hai phan so......");
            PS t = t1.Tong(t2);

            t.hien();
            Console.WriteLine("hieu hai phan so.......");
            PS h = t1.hieu(t2);

            h.hien();
            Console.WriteLine("tich hai phan so .......");
            PS f = t1.Tich(t2);

            f.hien();
            Console.WriteLine("thuong hai phan so......");
            PS Y = t1.thuong(t2);

            Y.hien();
        }
Esempio n. 2
0
        public PS thuong(PS t2)
        {
            PS t = new PS();

            t.ts = this.ts * t2.ms;
            t.ms = this.ms * t2.ts;
            return(t);
        }
Esempio n. 3
0
        public PS hieu(PS t2)
        {
            PS t = new PS();

            t.ts = this.ts * t2.ms - this.ms * t2.ts;
            t.ms = this.ms * t2.ms;
            return(t);
        }