Exemplo n.º 1
0
        private void btnCongPhanSo_Click(object sender, EventArgs e)
        {
            int tuSoA  = int.Parse(this.txtBoxTuSoA.Text);
            int mauSoA = int.Parse(this.txtBoxMauSoA.Text);

            int tuSoB  = int.Parse(this.txtBoxTuSoB.Text);
            int mauSoB = int.Parse(this.txtBoxMauSoB.Text);

            PhanSo kq = new PhanSo(tuSoA, mauSoA) + new PhanSo(tuSoB, mauSoB);

            kq = PhanSo.Reduce(kq);
            this.lblKetQua.Text     = "Ket qua cong hai phan so la: " + kq.tuSo + "/" + kq.mauSo;
            this.lblKetQua.Location = new System.Drawing.Point(this.Width / 2 - this.lblKetQua.Width / 2, this.lblKetQua.Location.Y);
        }
Exemplo n.º 2
0
        private void btnCongPhanSo_Click(object sender, EventArgs e)
        {
            int tusoa  = int.Parse(this.txtBoxtusoa.Text);
            int mausoa = int.Parse(this.txtBoxmausoa.Text);
            int tusob  = int.Parse(this.txtBoxtusob.Text);
            int mausob = int.Parse(this.txtBoxmausob.Text);

            PhanSo kq = new PhanSo(tusoa, mausoa) + new PhanSo(tusob, mausob);

            kq = PhanSo.Reduce(kq);

            this.label5.Text     = "ket qua cong 2 phan so la: " + kq.tuso + "/" + kq.mauso;
            this.label5.Location = new System.Drawing.Point(this.Width / 2 - this.label5.Width / 2, this.label5.Location.Y);
        }