示例#1
0
        private void equalKey_Click(object sender, RoutedEventArgs e)
        {
            switch (state)
            {
            case 1:
                num2 = num;
                break;

            case 2:
                num1 = num2;
                num2 = num;
                break;

            default:
                break;
            }
            expression.addOperation(num1.getNum(), num2.getNum(), operation);
            input.Text     = expression.calculateExpression().ToString();
            view.Text     += num.getNum().ToString() + "=";
            expressionView = false;
            num            = null;
            num            = new Num();
            state          = 0;
            num1           = num;
            num2           = num;
            expression     = null;
            expression     = new ExpressionCalc();
        }
示例#2
0
 private void cKey_Click(object sender, RoutedEventArgs e)
 {
     num        = null;
     num        = new Num();
     state      = 0;
     expression = null;
     expression = new ExpressionCalc();
     input.Text = num.getNum().ToString();
     view.Text  = "";
 }
示例#3
0
 public void TestExpression2()
 {
     ExpressionCalc.Caluc("1+2*(1+3)-3");
     Assert.AreEqual(ExpressionCalc.Reuslt, 6);
     Assert.AreEqual(ExpressionCalc.Rpn, "1213+*+3-");
 }
示例#4
0
 public void TestExpression1()
 {
     ExpressionCalc.Caluc("1+2/1");
     Assert.AreEqual(ExpressionCalc.Reuslt, 3);
     Assert.AreEqual(ExpressionCalc.Rpn, "121/+");
 }