コード例 #1
0
        public static mixel operator/(mixel a, mixel b)
        {
            mixel c = new mixel();

            a.Tofraction();
            b.Tofraction();
            c.Top    = a.Top * b.Bottom;
            c.Bottom = a.Bottom * b.Top;
            c.PSEnd();
            c.Tomixel();
            return(c);
        }
コード例 #2
0
        void BtnEqualClick(object sender, EventArgs e)
        {
            mixel a = new mixel();
            mixel b = new mixel();
            mixel c = new mixel();

            a.Top      = int.Parse(txtTop1.Text);
            a.Bottom   = int.Parse(txtBottom1.Text);
            a.Interger = int.Parse(tbInterger1.Text);
            b.Top      = int.Parse(txtTop2.Text);
            b.Bottom   = int.Parse(txtBottom2.Text);
            b.Interger = int.Parse(tbInterger2.Text);

            if (rdbPlus.Checked == true)
            {
                c = a + b;
            }

            //=========================
            else if (rdbSub.Checked == true)
            {
                c = a - b;
            }

            //========================
            else if (rdbMult.Checked == true)
            {
                c = a * b;
            }

            else if (rdbDivi.Checked == true)
            {
                c = a / b;
            }
            txtTop3.Text     = c.Top.ToString();
            txtBottom3.Text  = c.Bottom.ToString();
            tbInterger3.Text = c.Interger.ToString();
        }