예제 #1
0
        public static void UserInput(string theDigit)
        {
            if (inNumber == false)
            {
                if (inDecimal == true)
                {
                    currentX += "0.";
                    inDecimal = false;
                }
                else
                {
                    currentX += theDigit;
                }

                inNumber = true;
            }
            else
            {
                if (inDecimal == true && !currentX.Contains("."))
                {
                    currentX += ".";
                    inDecimal = false;
                }
                currentX += theDigit;
            }

            RPN_Stack.PushNoUpdate(double.Parse(currentX));
            Display.UpdateCurrentNumber(currentX);
        }
예제 #2
0
        public static void Exponents()
        {
            double valueX = RPN_Stack.Pop(),
                   valueY = RPN_Stack.Pop();

            RPN_Stack.Push(Math.Pow(valueY, valueX));
        }
예제 #3
0
        public static void Multiplication()
        {
            double valueX = RPN_Stack.Pop(),
                   valueY = RPN_Stack.Pop();

            RPN_Stack.Push(valueY * valueX);
        }
예제 #4
0
        public static void Division()
        {
            double valueX = RPN_Stack.Pop(),
                   valueY = RPN_Stack.Pop();

            RPN_Stack.Push(valueY / valueX);
        }
예제 #5
0
        public static void Subtraction()
        {
            double valueX = RPN_Stack.Pop(),
                   valueY = RPN_Stack.Pop();

            RPN_Stack.Push(valueY - valueX);
        }
예제 #6
0
        public static void Addition()
        {
            double valueX = RPN_Stack.Pop();
            double valueY = RPN_Stack.Pop();

            RPN_Stack.Push(valueY + valueX);
        }
예제 #7
0
        public static void SwapXY()
        {
            double valueX = RPN_Stack.Pop();
            double valueY = RPN_Stack.Pop();

            RPN_Stack.Push(valueX);
            RPN_Stack.Push(valueY);
        }
예제 #8
0
 public static void SquareRoot()
 {
     RPN_Stack.Push(Math.Sqrt(RPN_Stack.Pop()));
 }
예제 #9
0
 public static void Reciprocal()
 {
     RPN_Stack.Push(1 / RPN_Stack.Pop());
 }
예제 #10
0
 public static void SwitchSigns()
 {
     RPN_Stack.Push(RPN_Stack.Pop() * -1);
 }
예제 #11
0
 public static void XSquared()
 {
     RPN_Stack.Push(Math.Pow(RPN_Stack.Pop(), 2));
 }
예제 #12
0
 private void btnRollUp_Click(object sender, EventArgs e)
 {
     RPN_Stack.RollUp();
     Input.ResetInput();
 }
예제 #13
0
 private void btnClearX_Click(object sender, EventArgs e)
 {
     RPN_Stack.ClearX();
     Input.ResetInput();
 }
예제 #14
0
 private void btnEnter_Click(object sender, EventArgs e)
 {
     RPN_Stack.Push(0);
     Input.ResetInput();
 }