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(); }
public void TestCong_PhanSoAm() { PhanSo p1 = new PhanSo(-1, 2); PhanSo p2 = new PhanSo(3, 4); PhanSo p3 = p1.Cong(p2); Assert.AreEqual(2, p3.Tu, "Loi o tu so"); Assert.AreEqual(8, p3.Mau, "loi o mau so"); }
static void Main(string[] args) { PhanSo ob = new PhanSo(); ob.show(); ob.Cong(); ob.Tru(); ob.Nhan(); ob.Chia(); ob.SoSanh(); Console.ReadLine(); }