Exemple #1
0
        static void Main(string[] args)
        {
            PhanSo p1 = new PhanSo();

            p1.show();
            Console.WriteLine();
            PhanSo p2 = new PhanSo(3);

            p2.show();
            Console.WriteLine();
            Console.WriteLine("Nhap tu so: ");
            int TS = int.Parse(Console.ReadLine());

            Console.WriteLine("Nhap mau so: ");
            int    MS = int.Parse(Console.ReadLine());
            PhanSo p3 = new PhanSo(TS, MS);

            p3.show();
            Console.WriteLine();
            p1 = p2.Cong(p3);
            p1.show();
            p1 = p2.Tru(p3);
            p1.show();
            p1 = p2.Nhan(p3);
            p1.show();
            p1 = p2.Chia(p3);
            p1.show();
            Console.ReadLine();
        }
Exemple #2
0
        public void TestChia()
        {
            PhanSo p1 = new PhanSo(1, 2);
            PhanSo p2 = new PhanSo(3, 4);
            PhanSo p3 = p1.Chia(p2);

            Assert.AreEqual(4, p3.Tu, "Loi o tu so");
            Assert.AreEqual(6, p3.Mau, "loi o mau so");
        }
Exemple #3
0
        static void Main(string[] args)
        {
            PhanSo ob = new PhanSo();

            ob.show();
            ob.Cong();
            ob.Tru();
            ob.Nhan();
            ob.Chia();
            ob.SoSanh();
            Console.ReadLine();
        }
Exemple #4
0
 public void TestChia0()
 {
     PhanSo p1 = new PhanSo(1, 2);
     PhanSo p2 = new PhanSo(0, 4);
     PhanSo p3 = p1.Chia(p2);
 }