Beispiel #1
0
 private void ClearClick(object sender, EventArgs e)
 {
     first_num  = 0;
     second_num = 0;
     ResultBoxOne.Clear();
     ResultBoxTwo.Clear();
     operarator_pressed = false;
 }
Beispiel #2
0
        private void SolveClick(object sender, EventArgs e)
        {
            second_num = NumeralsToInt(ResultBoxOne.Text);
            int result;

            switch (operation)
            {
            case "+":
                result            = first_num + second_num;
                ResultBoxOne.Text = IntToNumerals(result);
                break;

            case "-":
                if ((first_num - second_num) < 0)
                {
                    ResultBoxOne.Text = "There are no negative numbers in Rome!";
                    break;
                }
                else
                {
                    result            = first_num - second_num;
                    ResultBoxOne.Text = IntToNumerals(result);
                    break;
                }

            case "*":
                result            = first_num * second_num;
                ResultBoxOne.Text = IntToNumerals(result);
                break;

            case "/":
                if (first_num % second_num != 0)
                {
                    ResultBoxOne.Text = "There are no decimals in Rome!";
                    break;
                }
                else
                {
                    result            = first_num / second_num;
                    ResultBoxOne.Text = IntToNumerals(result);
                    break;
                }
            }
            operarator_pressed = false;
            second_num         = first_num;
            ResultBoxTwo.Clear();
        }