示例#1
0
        private void testButton_Click(object sender, RoutedEventArgs e)
        {
            postfixTextBox.Text = "";
            string        input  = infixTextBox.Text;
            List <string> output = Postfixer.ConvertRPN(input);
            double        result = Postfixer.CalculateExpression(input);

            foreach (string t in output)
            {
                postfixTextBox.Text += t + " ";
            }
            resultTextBox.Text = result.ToString();
        }
示例#2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            leftTextBox.Text  = "";
            rightTextBox.Text = "";
            string[]      parts = equotTextBox.Text.Split('=');
            List <string> left  = Postfixer.ConvertRPN(parts[0]);
            List <string> right = Postfixer.ConvertRPN(parts[1]);

            foreach (var s in right)
            {
                rightTextBox.Text += s + " ";
            }
            foreach (var s in left)
            {
                leftTextBox.Text += s + " ";
            }
        }