Ejemplo n.º 1
0
        private void BotonOA_Click(object sender, EventArgs e)
        {
            try
            {
                var num1 = NumeroComplejo.Parse(textBoxOA1.Text);
                var num2 = int.Parse(textBoxOA2.Text);
                if (num2 <= 0)
                {
                    throw new Exception("Debe ingresar un numero natural.");
                }
                Raiz[] res;
                switch ((OperacionesAvanzadas)comboBoxOA.SelectedItem)
                {
                case OperacionesAvanzadas.Potenciacion:
                    res    = new Raiz[1];
                    res[0] = new Raiz {
                        NumeroComplejo = num1.Pow(num2)
                    };
                    break;

                case OperacionesAvanzadas.Radicacion:
                    res = num1.Root(num2);
                    break;

                default:
                    throw new Exception("Seleccione una operacion");
                }
                listBoxOA.DataSource = res;
                labelResulOA.Visible = listBoxOA.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
        }
Ejemplo n.º 2
0
 public Fasor(string amplitud, FunTrig funcion, string frecuencia, string fase)
 {
     Amplitud   = NumeroComplejo.ParseDouble(amplitud, "Amplitud");
     Funcion    = funcion;
     Frecuencia = NumeroComplejo.ParseDouble(frecuencia, "Frecuencia");
     Fase       = NumeroComplejo.ParseDouble(fase, "Fase");
 }
Ejemplo n.º 3
0
 private void BotonConvClick(object sender, EventArgs e)
 {
     try
     {
         labelResulConv.Text = "Resultado: "
                               + NumeroComplejo.Parse(textBoxConv.Text).Convertir().ToString();
         labelResulConv.Visible = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.Message);
     }
 }
Ejemplo n.º 4
0
        private void BotonOBClick(object sender, EventArgs e)
        {
            try
            {
                var            num1 = NumeroComplejo.Parse(textBoxOB1.Text);
                var            num2 = NumeroComplejo.Parse(textBoxOB2.Text);
                NumeroComplejo res  = null;
                switch ((OperacionesBasicas)comboBoxOB.SelectedItem)
                {
                case OperacionesBasicas.Suma:
                    res = num1 + num2;
                    break;

                case OperacionesBasicas.Resta:
                    res = num1 - num2;
                    break;

                case OperacionesBasicas.Multiplicacion:
                    res = num1 * num2;
                    break;

                case OperacionesBasicas.Division:
                    res = num1 / num2;
                    break;

                default:
                    throw new Exception("Seleccione una operacion");
                }
                labelResulOB.Text    = "Resultado: " + res.ToString();
                labelResulOB.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
        }