private void UnaryOperator_Click(object sender, System.EventArgs e)
        {
            if (textBox1.Text == "")
            {
                textBox1.Text = "0";
            }
            else
            {
                Button btn = (Button)sender;
                switch (btn.Text)
                {
                case "Sq. Rt.":
                    textBox1.Text = (ArithmaticOperations.SquareRoot(double.Parse(textBox1.Text))).ToString();
                    break;

                case "Log x":
                    textBox1.Text = (ScientificOperations.Log10(double.Parse(textBox1.Text))).ToString();
                    break;

                case "Ln x":
                    textBox1.Text = (ScientificOperations.Ln(double.Parse(textBox1.Text))).ToString();
                    break;

                case "1/x":
                    textBox1.Text = (ScientificOperations.Inverse(double.Parse(textBox1.Text))).ToString();
                    break;

                case "!":
                    textBox1.Text = (ScientificOperations.Factorial(int.Parse(textBox1.Text))).ToString();
                    break;

                case "+/-":
                    textBox1.Text = (ArithmaticOperations.PlusMinus(double.Parse(textBox1.Text))).ToString();
                    break;

                case "Sin":
                    textBox1.Text = (ScientificOperations.Sin(double.Parse(textBox1.Text))).ToString();
                    break;

                case "Cos":
                    textBox1.Text = (ScientificOperations.Cos(double.Parse(textBox1.Text))).ToString();
                    break;

                case "Tan":
                    textBox1.Text = (ScientificOperations.Tan(double.Parse(textBox1.Text))).ToString();
                    break;

                case "<-":
                    if (textBox1.Text.Length > 0)
                    {
                        int len = textBox1.Text.Length;
                        textBox1.Text = textBox1.Text.Substring(0, len - 1);
                    }
                    if (textBox1.Text == "")
                    {
                        textBox1.Text = "0";
                    }
                    break;
                }
            }
        }
示例#2
0
 public double Calculate()
 {
     return(ScientificOperations.Tan(_degree));
 }
示例#3
0
 public double Calculate()
 {
     return(ScientificOperations.Decrement(_num));
 }
示例#4
0
 public double Calculate()
 {
     return(Convert.ToDouble(ScientificOperations.Factorial(Convert.ToInt32(value))));
 }
示例#5
0
 public double Calculate()
 {
     return(ScientificOperations.Inverse(value));
 }
示例#6
0
 public double Calculate()
 {
     return(ScientificOperations.Log10(value));
 }