Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #4
0
 public clsPhanSo(clsPhanSo pA)
 {
     this.iTuSo  = pA.iTuSo;
     this.iMauSo = pA.iMauSo;
 }