Пример #1
0
        private void bt1_Click(object sender, EventArgs e)
        {
            phanso a, b, c;

            a = new phanso(int.Parse(tbTuSo1.Text), int.Parse(tbMauSo1.Text));
            b = new phanso(int.Parse(tbTuSo2.Text), int.Parse(tbMauSo2.Text));
            if (rd1.Checked)
            {
                c = phanso.Cong(a, b);
            }
            else if (rd2.Checked)
            {
                c = phanso.Tru(a, b);
            }
            else if (rd3.Checked)
            {
                c = phanso.Nhan(a, b);
            }
            else
            {
                c = phanso.Chia(a, b);
            }
            tbTuSo3.Text  = c.TuSo.ToString();
            tbMauSo3.Text = c.MauSo.ToString();
        }
Пример #2
0
        public static phanso Chia(phanso a, phanso b)
        {
            phanso c = new phanso();

            c.iTuSo  = a.iTuSo * b.iMauSo;
            c.iMauSo = a.iMauSo * b.iTuSo;
            c.ToiGian();
            return(c);
        }
Пример #3
0
        public static phanso Cong(phanso a, phanso b)
        {
            phanso c = new phanso();

            c.iTuSo  = (a.iTuSo * b.iMauSo) + (b.iTuSo * a.iMauSo);
            c.iMauSo = a.iMauSo * b.iMauSo;
            c.ToiGian();
            return(c);
        }