Ejemplo n.º 1
0
 public TamThuc(TamThuc tt)
 {
     a = tt.a;
     b = tt.b;
     c = tt.c;
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            TamThuc a = new TamThuc();

            a.NhapTamThuc();
            a.XuatTamThuc();
            TamThuc b = new TamThuc();

            b.NhapTamThuc();
            b.XuatTamThuc();
            TamThuc c = new TamThuc();

            c = a + b;
            Console.WriteLine("-----------------------------------------------------");
            Console.Write("Cong hai tam thuc: ");
            c.XuatTamThuc();
            Console.WriteLine("-----------------------------------------------------");
            Console.Write("Tru hai tam thuc: ");
            c = a - b;
            c.XuatTamThuc();
            if ((bool)a)
            {
                Console.WriteLine("-----------------------------------------------------");
                a.XuatTamThuc(); Console.WriteLine("Co nghiem");
            }
            else
            {
                Console.WriteLine("-----------------------------------------------------");
                a.XuatTamThuc(); Console.WriteLine("Vo nghiem");
            }
            if ((bool)b)
            {
                Console.WriteLine("-----------------------------------------------------");
                b.XuatTamThuc(); Console.WriteLine("Co nghiem");
            }
            else
            {
                Console.WriteLine("-----------------------------------------------------");
                b.XuatTamThuc(); Console.WriteLine("Vo nghiem");
            }
            Console.WriteLine("-----------------------------------------------------");

            TamThuc d = new TamThuc();

            Console.WriteLine("Nhap mot so co 3 chu so");
            d = (TamThuc)int.Parse(Console.ReadLine());
            d.XuatTamThuc();
            Console.WriteLine("-----------------------------------------------------");
            TamThuc e = new TamThuc();

            e = a++;
            e.XuatTamThuc();
            Console.WriteLine("-----------------------------------------------------");
            if (a == b)
            {
                Console.WriteLine("Hai tam thuc a va b bang nhau");
            }
            else
            {
                Console.WriteLine("Hai tam thuc a va b bang nhau");
            }
            Console.ReadLine();
        }