Пример #1
0
        public void one_click(object sender, EventArgs e)
        {
            Button button = (Button)sender;

            operation = button.Text;

            if (operation == "%")
            {
                textBox_Result.Text = ((Double.Parse(textBox_Result.Text) / 100)).ToString();
            }
            else if (operation == "BIN")
            {
                int i = Convert.ToInt32(textBox_Result.Text);
                textBox_Result.Text = Convert.ToString(i, 16);
            }

            else if (operation == "√")
            {
                textBox_Result.Text = Logic.Sqrt(Double.Parse(textBox_Result.Text)).ToString();
            }
            else if (operation == "x^2")
            {
                textBox_Result.Text = Logic.Square(Double.Parse(textBox_Result.Text)).ToString();
            }
            else if (operation == "sin")
            {
                textBox_Result.Text = Logic.Sin(Double.Parse(textBox_Result.Text)).ToString();
            }
            else if (operation == "cos")
            {
                textBox_Result.Text = Logic.Cos(Double.Parse(textBox_Result.Text)).ToString();
            }
            else if (operation == "MS")
            {
                memory = (Double.Parse(textBox_Result.Text));
            }
            else if (operation == "M+")
            {
                memory += ((Double.Parse(textBox_Result.Text)));
            }
            else if (operation == "M-")
            {
                memory = ((Double.Parse(textBox_Result.Text) - memory));
            }
            else if (operation == "MR")
            {
                textBox_Result.Clear();
                textBox_Result.Text = memory + "";
            }
            else if (operation == "MC")
            {
                memory = 0;
            }

            result_value  = Double.Parse(textBox_Result.Text);
            equation.Text = "";
        }