numeros imaginarios

24
Bienvenido a su calculadora using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Numeros_Complejos { public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void timer1_Tick( object sender, EventArgs e) { this .Dispose( true ); } private void textBox1_TextChanged( object sender, EventArgs e) { } } } Primer numero using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Numeros_Complejos

Upload: carlos

Post on 11-Feb-2016

240 views

Category:

Documents


6 download

DESCRIPTION

Codigo

TRANSCRIPT

Page 1: numeros imaginarios

Bienvenido a su calculadora

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;

namespace Numeros_Complejos{ public partial class Form2 : Form { public Form2() { InitializeComponent(); }

private void timer1_Tick(object sender, EventArgs e) { this.Dispose(true); }

private void textBox1_TextChanged(object sender, EventArgs e) {

} }}

Primer numero

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;

namespace Numeros_Complejos{ public partial class Form1 : Form {

Complejo micomp1; Complejo micomp2; Complejo res = new Complejo(); String ig;

Page 2: numeros imaginarios

public Form1() { InitializeComponent(); }

private void Form1_Load(object sender, EventArgs e) { Form mipresentacion; mipresentacion = new Form2(); mipresentacion.ShowDialog(); }

private void pictureBox1_Click(object sender, EventArgs e) { try { micomp1 =new Complejo( double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 =new Complejo( double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res= micomp1+micomp2; label8.Text = "" + micomp1.R+" + " + micomp1.I+" i"; label9.Text = micomp2.R+" + " +micomp2.I+ " i"; label10.Text = "El resultado de la suma es= "+ res.R+" + "+res.I+" i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text=""; label9.Text=""; label10.Text=""; }

}

private void pictureBox2_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 - micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i";

Page 3: numeros imaginarios

label10.Text = "El resultado de la resta es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox3_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 * micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la multiplicación es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox4_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 /micomp2;

Page 4: numeros imaginarios

label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la división es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox5_Click(object sender, EventArgs e) { }

private void pictureBox6_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); ig = micomp1 == micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = ig;

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void button1_Click(object sender, EventArgs e) { textBox1.Text = "";

Page 5: numeros imaginarios

textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; }

private void button2_Click(object sender, EventArgs e) { Application.Exit(); }

private void label2_Click(object sender, EventArgs e) {

} }}

Segundo numero

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;

namespace Numeros_Complejos{ public partial class Form1 : Form {

Complejo micomp1; Complejo micomp2; Complejo res = new Complejo(); String ig; public Form1() { InitializeComponent(); }

private void Form1_Load(object sender, EventArgs e) { Form mipresentacion; mipresentacion = new Form2(); mipresentacion.ShowDialog(); }

private void pictureBox1_Click(object sender, EventArgs e) { try

Page 6: numeros imaginarios

{ micomp1 =new Complejo( double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 =new Complejo( double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res= micomp1+micomp2; label8.Text = "" + micomp1.R+" + " + micomp1.I+" i"; label9.Text = micomp2.R+" + " +micomp2.I+ " i"; label10.Text = "El resultado de la suma es= "+ res.R+" + "+res.I+" i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text=""; label9.Text=""; label10.Text=""; }

}

private void pictureBox2_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 - micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la resta es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; }

Page 7: numeros imaginarios

}

private void pictureBox3_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 * micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la multiplicación es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox4_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 /micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la división es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = "";

Page 8: numeros imaginarios

label10.Text = ""; } }

private void pictureBox5_Click(object sender, EventArgs e) { }

private void pictureBox6_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); ig = micomp1 == micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = ig;

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void button1_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; }

private void button2_Click(object sender, EventArgs e) { Application.Exit(); }

private void label2_Click(object sender, EventArgs e) {

}

Page 9: numeros imaginarios

private void label3_Click(object sender, EventArgs e) {

} }}

Ingrese parte real

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;

namespace Numeros_Complejos{ public partial class Form1 : Form {

Complejo micomp1; Complejo micomp2; Complejo res = new Complejo(); String ig; public Form1() { InitializeComponent(); }

private void Form1_Load(object sender, EventArgs e) { Form mipresentacion; mipresentacion = new Form2(); mipresentacion.ShowDialog(); }

private void pictureBox1_Click(object sender, EventArgs e) { try { micomp1 =new Complejo( double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 =new Complejo( double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res= micomp1+micomp2; label8.Text = "" + micomp1.R+" + " + micomp1.I+" i"; label9.Text = micomp2.R+" + " +micomp2.I+ " i";

Page 10: numeros imaginarios

label10.Text = "El resultado de la suma es= "+ res.R+" + "+res.I+" i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text=""; label9.Text=""; label10.Text=""; }

}

private void pictureBox2_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 - micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la resta es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox3_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text));

Page 11: numeros imaginarios

micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 * micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la multiplicación es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox4_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 /micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la división es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox5_Click(object sender, EventArgs e) { }

Page 12: numeros imaginarios

private void pictureBox6_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); ig = micomp1 == micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = ig;

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void button1_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; }

private void button2_Click(object sender, EventArgs e) { Application.Exit(); }

private void label2_Click(object sender, EventArgs e) {

}

private void label3_Click(object sender, EventArgs e) {

}

private void label5_Click(object sender, EventArgs e) {

Page 13: numeros imaginarios

} }}

Ingrese parte imaginaria

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;

namespace Numeros_Complejos{ public partial class Form1 : Form {

Complejo micomp1; Complejo micomp2; Complejo res = new Complejo(); String ig; public Form1() { InitializeComponent(); }

private void Form1_Load(object sender, EventArgs e) { Form mipresentacion; mipresentacion = new Form2(); mipresentacion.ShowDialog(); }

private void pictureBox1_Click(object sender, EventArgs e) { try { micomp1 =new Complejo( double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 =new Complejo( double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res= micomp1+micomp2; label8.Text = "" + micomp1.R+" + " + micomp1.I+" i"; label9.Text = micomp2.R+" + " +micomp2.I+ " i"; label10.Text = "El resultado de la suma es= "+ res.R+" + "+res.I+" i";

Page 14: numeros imaginarios

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text=""; label9.Text=""; label10.Text=""; }

}

private void pictureBox2_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 - micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la resta es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox3_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text));

Page 15: numeros imaginarios

res = micomp1 * micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la multiplicación es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox4_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 /micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la división es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox5_Click(object sender, EventArgs e) { }

private void pictureBox6_Click(object sender, EventArgs e)

Page 16: numeros imaginarios

{ try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); ig = micomp1 == micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = ig;

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void button1_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; }

private void button2_Click(object sender, EventArgs e) { Application.Exit(); }

private void label2_Click(object sender, EventArgs e) {

}

private void label3_Click(object sender, EventArgs e) {

}

private void label5_Click(object sender, EventArgs e) {

}

Page 17: numeros imaginarios

private void label7_Click(object sender, EventArgs e) {

} }}

Suma

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;

namespace Numeros_Complejos{ public partial class Form1 : Form {

Complejo micomp1; Complejo micomp2; Complejo res = new Complejo(); String ig; public Form1() { InitializeComponent(); }

private void Form1_Load(object sender, EventArgs e) { Form mipresentacion; mipresentacion = new Form2(); mipresentacion.ShowDialog(); }

private void pictureBox1_Click(object sender, EventArgs e) { try { micomp1 =new Complejo( double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 =new Complejo( double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res= micomp1+micomp2; label8.Text = "" + micomp1.R+" + " + micomp1.I+" i"; label9.Text = micomp2.R+" + " +micomp2.I+ " i";

Page 18: numeros imaginarios

label10.Text = "El resultado de la suma es= "+ res.R+" + "+res.I+" i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text=""; label9.Text=""; label10.Text=""; }

}

private void pictureBox2_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 - micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la resta es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox3_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text));

Page 19: numeros imaginarios

micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 * micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la multiplicación es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox4_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); res = micomp1 /micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = "El resultado de la división es= " + res.R + " + " + res.I + " i";

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void pictureBox5_Click(object sender, EventArgs e) { }

Page 20: numeros imaginarios

private void pictureBox6_Click(object sender, EventArgs e) { try { micomp1 = new Complejo(double.Parse(textBox1.Text), double.Parse(textBox2.Text)); micomp2 = new Complejo(double.Parse(textBox3.Text), double.Parse(textBox4.Text)); ig = micomp1 == micomp2; label8.Text = "" + micomp1.R + " + " + micomp1.I + " i"; label9.Text = micomp2.R + " + " + micomp2.I + " i"; label10.Text = ig;

} catch (SystemException e1) { MessageBox.Show("Por favor las entradas deben ser numericas!!!" + e1.Message, "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; } }

private void button1_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; label8.Text = ""; label9.Text = ""; label10.Text = ""; }

private void button2_Click(object sender, EventArgs e) { Application.Exit(); }

private void label2_Click(object sender, EventArgs e) {

}

private void label3_Click(object sender, EventArgs e) {

}

private void label5_Click(object sender, EventArgs e) {

Page 21: numeros imaginarios

}

private void label7_Click(object sender, EventArgs e) {

} }}