
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_3._4_Visual
{
public partial class Form1 : Form
{
double temp, fah, cel;
char tipo;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
temp = double.Parse(textBox1.Text);
tipo = char.Parse(textBox2.Text);
if (tipo=='f')//(tipo=='F')
{
cel=(5.0/9.0)*(temp-32.0);
label3.Text="La temperatura " + temp + " Fahrenheit es igual a " + cel + " grados Celcius";
}
else
{
if(tipo=='c')//(tipo=='C')
{
fah=(9.0/5.0)*temp+32.0;
label3.Text = "La temperatura" + temp + " grados Celcius es igual a " + fah + " grados Fahrenheit";
}
else
label3.Text="Datos Incorrectos";
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
label3.Text = " ";
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}

No hay comentarios:
Publicar un comentario