
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace practica_4._1_windows
{
public partial class Form1 : Form
{
int tipo;
double dato1, dato2, resultado=0.0;
public Form1()
{
dato1 = dato2 = resultado = 0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
tipo = int.Parse(textBox1.Text);
dato1 = double.Parse(textBox2.Text);
dato2=double.Parse(textBox3.Text);
switch(tipo)
{
case 1:resultado = dato1 + dato2;
textBox4.Text = resultado.ToString();
break;
case 2:
resultado = dato1 - dato2;
textBox4.Text = resultado.ToString();
break;
case 3:
resultado = dato1 * dato2;
textBox4.Text = resultado.ToString();
break;
case 4:
resultado = dato1 / dato2;
textBox4.Text = resultado.ToString();
break;
default: textBox4.Text = "PRACIONO OPCION EQUIVOCADA";
break;
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}

No hay comentarios:
Publicar un comentario