コード例 #1
0
 private void sqrtBtn_Click(object sender, EventArgs e)
 {
     X                   = inputedNumber;
     C                   = MathManager.Sqrt(X);
     inputedNumber       = C;
     resultsTextBox.Text = C.ToString().Replace(',', '.');
 }
コード例 #2
0
        private void equalBtn_Click(object sender, EventArgs e)
        {
            switch (mathOperation)
            {
            case "plus":
                B                   = inputedNumber;
                C                   = MathManager.Plus(A, B);
                inputedNumber       = C;
                resultsTextBox.Text = C.ToString().Replace(',', '.');
                break;

            case "minus":
                B                   = inputedNumber;
                C                   = MathManager.Minus(A, B);
                inputedNumber       = C;
                resultsTextBox.Text = C.ToString().Replace(',', '.');
                break;

            case "multi":
                B                   = inputedNumber;
                C                   = MathManager.Multiplication(A, B);
                inputedNumber       = C;
                resultsTextBox.Text = C.ToString().Replace(',', '.');
                break;

            case "mod":
                B                   = inputedNumber;
                C                   = MathManager.Mod(A, B);
                inputedNumber       = C;
                resultsTextBox.Text = C.ToString().Replace(',', '.');
                break;

            case "div":
                try
                {
                    B                   = inputedNumber;
                    C                   = MathManager.Division(A, B);
                    inputedNumber       = C;
                    resultsTextBox.Text = C.ToString().Replace(',', '.');
                }
                catch (DivideByZeroException ex)
                {
                    textBoxTip.ToolTipIcon = ToolTipIcon.Error;
                    textBoxTip.Show(ex.Message, resultsTextBox, 1000);
                    return;
                }
                break;
            }
        }
コード例 #3
0
 private void oneDivXBtn_Click(object sender, EventArgs e)
 {
     try
     {
         A                   = 1;
         B                   = inputedNumber;
         C                   = MathManager.Division(A, B);
         inputedNumber       = C;
         resultsTextBox.Text = C.ToString().Replace(',', '.');
     }
     catch (DivideByZeroException ex)
     {
         textBoxTip.ToolTipIcon = ToolTipIcon.Error;
         textBoxTip.Show(ex.Message, resultsTextBox, 1000);
         return;
     }
 }