예제 #1
0
        public static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");
            clsPhanSo a, b, c, d, e, f, g;

            a = new clsPhanSo();
            b = new clsPhanSo(1, 6);
            c = new clsPhanSo(1, 3);
            //d = clsPhanSo.Cong(b,c);
            d = b + c;
            e = clsPhanSo.Tru(b, c);
            try
            {
                f = clsPhanSo.Chia(b, c);
                f.In();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }


            a.In();
            d.In();
            e.In();

            // TODO: Implement Functionality Here

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
예제 #2
0
        public static clsPhanSo Nhan(clsPhanSo pA, clsPhanSo pB)
        {
            clsPhanSo psC = new clsPhanSo();

            psC.iTuSo  = pA.iTuSo * pB.iTuSo;
            psC.iMauSo = pA.iMauSo * pB.iMauSo;
            psC.ToiGian();
            return(psC);
        }
예제 #3
0
        public static clsPhanSo Chia(clsPhanSo pA, clsPhanSo pB)
        {
            if (pB.iTuSo == 0)
            {
                throw new Exception("Khong the chia cho 0");
                return(null);
            }
            clsPhanSo psC = new clsPhanSo();

            psC.iTuSo  = pA.iTuSo * pB.iMauSo;
            psC.iMauSo = pA.iMauSo * pB.iTuSo;
            psC.ToiGian();
            return(psC);
        }
예제 #4
0
 public clsPhanSo(clsPhanSo pA)
 {
     this.iTuSo  = pA.iTuSo;
     this.iMauSo = pA.iMauSo;
 }