public void TestHPTCo2Nghiem()
        {
            this.a = new double[] { 5, 3, 11, 6, 2, 10 };
            x      = -1;
            y      = -1;

            this.returnMessage = pt.GiaiHPTbacnhat2an(a[0], a[1], a[2], a[3], a[4], a[5], ref x, ref y);

            Assert.AreEqual(coNghiem, this.returnMessage);
            Assert.AreEqual(x, 1);
            Assert.AreEqual(y, 2);
        }
        private void bt_bang_Click(object sender, EventArgs e)
        {
            //Tinh toan cong tru nhan chia
            if (mode == 1)
            {
                if (!kiemtra)
                {
                    Tinhtoan();
                    CoTinhdon = true;
                }
            }
            //giai he phuong trinh 2 an
            if (mode == 2)
            {
                if (txt_ketqua.Text == "nhap a1")
                {
                    if (txt_pheptinh.Text == "")
                    {
                        a1 = 0;
                        return;
                    }
                    a1 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap b1";
                    txt_pheptinh.Text = "";
                    return;
                }
                if (txt_ketqua.Text == "nhap b1")
                {
                    if (txt_pheptinh.Text == "")
                    {
                        b1 = 0;
                        return;
                    }
                    b1 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap c1";
                    txt_pheptinh.Text = "";
                    return;
                }
                if (txt_ketqua.Text == "nhap c1")
                {
                    if (txt_pheptinh.Text == "")
                    {
                        c1 = 0;
                        return;
                    }
                    c1 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap a2";
                    txt_pheptinh.Text = "";
                    return;
                }
                if (txt_ketqua.Text == "nhap a2")
                {
                    if (txt_pheptinh.Text == "")
                    {
                        a2 = 0;
                        return;
                    }
                    a2 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap b2";
                    txt_pheptinh.Text = "";


                    return;
                }
                if (txt_ketqua.Text == "nhap b2")
                {
                    if (txt_pheptinh.Text == "")
                    {
                        b2 = 0;
                        return;
                    }
                    b2 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text = "nhap c2";

                    txt_pheptinh.Text = "";

                    return;
                }
                if (txt_ketqua.Text == "nhap c2")
                {
                    if (txt_pheptinh.Text == "")
                    {
                        c2 = 0;
                        return;
                    }
                    c2 = double.Parse(txt_pheptinh.Text);
                    txt_pheptinh.Text = "";
                    txt_ketqua.Text   = "";
                }
                txt_pheptinh.Text = h.GiaiHPTbacnhat2an(a1, b1, c1, a2, b2, c2, ref x, ref y);//gọi hàm trong lop pt.cs, h là lớp pt đã khai báo trước.
                txt_ketqua.Text   = "";
                if (txt_pheptinh.Text == "Hệ phương trình có 1 nghiệm")
                {
                    txt_ketqua.Text = "X=" + x.ToString() + "   " + "Y=" + y.ToString();
                }
            }
            //Giai PT bac 2
            if (mode == 3)
            {
                if (txt_ketqua.Text == "nhap a")
                {
                    a = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap b";
                    txt_pheptinh.Text = "";
                    return;
                }
                if (txt_ketqua.Text == "nhap b")
                {
                    b = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap c";
                    txt_pheptinh.Text = "";
                    return;
                }
                if (txt_ketqua.Text == "nhap c")
                {
                    c = double.Parse(txt_pheptinh.Text);
                    txt_pheptinh.Text = "";
                }
                txt_pheptinh.Text = h.giaiPhuongTrinhBacHai(a, b, c, ref x1, ref x2);//gọi hàm trong lop pt.cs, h là lớp pt đã khai báo trước.
                txt_ketqua.Text   = "";
                if (txt_pheptinh.Text == "Phương trình có 1 nghiệm")
                {
                    txt_ketqua.Text = "X=" + x1.ToString();
                }
                if (txt_pheptinh.Text == "Phương trình có 2 nghiệm")
                {
                    txt_ketqua.Text = "X1=" + x1.ToString() + "   " + "X2=" + x2.ToString();
                }
            }
            //Giai he phuong trinh bac nhat 3 an
            if (mode == 4)
            {
                if (txt_ketqua.Text == "nhap a1")
                {
                    a1 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap b1";
                    txt_pheptinh.Text = "";
                    return;
                }
                if (txt_ketqua.Text == "nhap b1")
                {
                    b1 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap c1";
                    txt_pheptinh.Text = "";
                    return;
                }
                if (txt_ketqua.Text == "nhap c1")
                {
                    c1 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap d1";
                    txt_pheptinh.Text = "";
                    return;
                }
                if (txt_ketqua.Text == "nhap d1")
                {
                    d1 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text = "nhap a2";

                    txt_pheptinh.Text = "";

                    return;
                }
                if (txt_ketqua.Text == "nhap a2")
                {
                    a2 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap b2";
                    txt_pheptinh.Text = "";
                    return;
                }
                if (txt_ketqua.Text == "nhap b2")
                {
                    b2 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text = "nhap c2";

                    txt_pheptinh.Text = "";

                    return;
                }
                if (txt_ketqua.Text == "nhap c2")
                {
                    c2 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap d2";
                    txt_pheptinh.Text = "";
                    return;
                }
                if (txt_ketqua.Text == "nhap d2")
                {
                    d2 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text = "nhap a3";

                    txt_pheptinh.Text = "";

                    return;
                }
                if (txt_ketqua.Text == "nhap a3")
                {
                    a3 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap b3";
                    txt_pheptinh.Text = "";


                    return;
                }
                if (txt_ketqua.Text == "nhap b3")
                {
                    b3 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text = "nhap c3";

                    txt_pheptinh.Text = "";

                    return;
                }
                if (txt_ketqua.Text == "nhap c3")
                {
                    c3 = double.Parse(txt_pheptinh.Text);
                    txt_ketqua.Text   = "nhap d3";
                    txt_pheptinh.Text = "";
                    return;
                }
                if (txt_ketqua.Text == "nhap d3")
                {
                    d3 = double.Parse(txt_pheptinh.Text);
                    txt_pheptinh.Text = "";
                }
                txt_pheptinh.Text = h.GiaiHPTbacnhat3an(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, ref x, ref y, ref z);//gọi hàm trong lop pt.cs, h là lớp pt đã khai báo trước.
                txt_ketqua.Text   = "";
                if (txt_pheptinh.Text == "Hệ phương trình có 1 nghiệm")
                {
                    txt_ketqua.Text = "X=" + x.ToString() + "   " + "y=" + y.ToString() + " " + "z=" + z.ToString();
                }
            }
        }