Exemplo n.º 1
0
        private void BtnResultado_Click(object sender, EventArgs e)
        {
            segundo = double.Parse(TxtBPantalla.Text);

            double Suma;
            double Resta;
            double Multiplicacion;
            double Division;

            switch (operador)
            {
            case "+":
                Suma = obj.Sumar((primero), (segundo));
                TxtBPantalla.Text = Suma.ToString();
                break;

            case "-":
                Resta             = obj2.Restar((primero), (segundo));
                TxtBPantalla.Text = Resta.ToString();
                break;

            case "*":
                Multiplicacion    = obj3.Multiplicacion((primero), (segundo));
                TxtBPantalla.Text = Multiplicacion.ToString();
                break;

            case "/":
                Division          = obj4.Division((primero), (segundo));
                TxtBPantalla.Text = Division.ToString();
                break;
            }
        }
Exemplo n.º 2
0
        private void Buttonigual_Click(object sender, RoutedEventArgs e)
        {
            num2 = Double.Parse(resTextBox.Text);

            double Suma;
            double Resta;
            double Multiplicacion;
            double Division;

            switch (Operation)
            {
            case "+":
                Suma            = op1.Sum((num1), (num2));
                resTextBox.Text = Suma.ToString();

                break;

            case "-":
                Resta           = op2.Res((num1), (num2));
                resTextBox.Text = Resta.ToString();
                break;

            case "*":
                Multiplicacion  = op3.Multi((num1), (num2));
                resTextBox.Text = Multiplicacion.ToString();
                break;

            case "/":
                if (num2 == 0)
                {
                    MessageBox.Show("SYSTEM ERROR");
                    resTextBox.Clear();
                }
                else
                {
                    Division        = op4.Div((num1), (num2));
                    resTextBox.Text = Division.ToString();
                }
                break;

            case " ":

                MessageBox.Show("no se encontro en numero secundario");


                break;
            }
        }
Exemplo n.º 3
0
        private void btnResta(object sender, EventArgs e)
        {
            Double n1, n2, Resta;

            n1    = Convert.ToDouble(txtNum1.Text);
            n2    = Convert.ToDouble(txtNum2.Text);
            Resta = n1 - n2;
            labelResultado.Text = Resta.ToString();
            if (txtNum1.Text == "")
            {
                labelResultado.Text = "No hay numero 1";
            }
            else if (txtNum2.Text == "")
            {
                labelResultado.Text = "No hay numero 2";
            }
        }
Exemplo n.º 4
0
        private void Btnigual_Click(object sender, EventArgs e)
        {
            Segundo = double.Parse(Txtmostrar.Text);

            double Suma;
            double Resta;
            double Division;
            double Multiplicacion;


            switch (Operando)
            {
            case "+":
            {
                Suma            = Operador.Sumar((Primero), (Segundo));
                Txtmostrar.Text = Suma.ToString();
            }
            break;

            case "-":
            {
                Resta           = Operador.Restar((Primero), (Segundo));
                Txtmostrar.Text = Resta.ToString();
            }
            break;

            case "/":
            {
                Division        = Operador.Dividir((Primero), (Segundo));
                Txtmostrar.Text = Division.ToString();
            }
            break;

            case "*":
            {
                Multiplicacion  = Operador.Multiplicar((Primero), (Segundo));
                Txtmostrar.Text = Multiplicacion.ToString();
            }
            break;
            }
        }