Exemplo n.º 1
0
 private void button5_Click(object sender, EventArgs e)
 {
     if (textBox2.Text == "History")
     {
         textBox2.Text = String.Empty;
     }
     textBox2.Text += "(" + textBox1.Text + "=";
     try { textBox1.Text = RPN.Calculate(textBox1.Text).ToString(); }
     catch (MyException ex) { textBox1.Text = ex.type; }
     textBox2.Text += textBox1.Text + "),";
 }
        public double method_for_tests(string str)
        {
            StringBuilder st = new StringBuilder(str);

            if (st[0] == '-')
            {
                st[0] = 'm';
            }
            int i = 0;

            while (i != st.Length)
            {
                if (st[i] == '-')
                {
                    if (st[i - 1] == '^' || st[i - 1] == '/' || st[i - 1] == '*')
                    {
                        st[i] = 'm';
                    }
                }
                i++;
            }
            return(RPN.Calculate(st.ToString()));
        }
 private void button5_Click(object sender, EventArgs e)
 {
     try { textBox1.Text = RPN.Calculate(textBox1.Text).ToString(); }
     catch (MyException ex) { textBox1.Text = ex.type; }
 }