示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            ClsPhanso a, b, c;

            a = new ClsPhanso(int.Parse(ts1.Text), int.Parse(ms1.Text));
            b = new ClsPhanso(int.Parse(ts2.Text), int.Parse(ms2.Text));
            if (rbCong.Checked == true)
            {
                c = ClsPhanso.Cong(a, b);
            }
            else if (rbtru.Checked == true)
            {
                c = ClsPhanso.Tru(a, b);
            }
            else if (rbnhan.Checked == true)
            {
                c = ClsPhanso.Nhan(a, b);
            }
            else if (rbchia.Checked == true)
            {
                c = ClsPhanso.Chia(a, b);
            }
            else
            {
                c = new ClsPhanso();
            }
            ts3.Text = c.tuso.ToString();
            ms3.Text = c.mauso.ToString();
        }
示例#2
0
        public static ClsPhanso Nhan(ClsPhanso a, ClsPhanso b)
        {
            ClsPhanso c = new ClsPhanso();

            c.ts = a.ts * b.ts;
            c.ms = a.ms * b.ms;
            c.Toigian();
            return(c);
        }