コード例 #1
0
        private void CurrentAddMemory_Click(object sender, EventArgs e)
        {
            //MainDisplay.Text = Expression + "+" + MainDisplay.Text;
            ReversePolishEntry rpe = new ReversePolishEntry(MainDisplay.Text);

            MainDisplay.Text = rpe.Calculate(rpe.RPEformer(Expression + "+" + rpe.Expression));
        }
コード例 #2
0
        private void CurrentSubMemory_Click(object sender, EventArgs e)
        {
            //MainDisplay.Text = Expression + "-" + MainDisplay.Text;
            ReversePolishEntry rpe = new ReversePolishEntry(MainDisplay.Text);

            if (rpe.Expression[0] != '-')
            {
                MainDisplay.Text = rpe.Calculate(rpe.RPEformer(Expression + "-" + rpe.Expression));
            }
            else
            {
                MainDisplay.Text = rpe.Calculate(rpe.RPEformer(Expression + rpe.Expression));
            }
        }
コード例 #3
0
 private void Equally_Click(object sender, EventArgs e)
 {
     try
     {
         ReversePolishEntry rpe = new ReversePolishEntry(MainDisplay.Text);
         if (rpe.error == null)
         {
             MainDisplay.Text = rpe.Calculate(rpe.RPEformer(rpe.Expression));
         }
     }
     catch (Exception exception)
     {
         ReversePolishEntry rpe = new ReversePolishEntry();
         rpe.error = "Wrong expression!";
     }
 }