Practica 4_1
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
double x1;
double x2;
double y1;
double distancia;
double y2;
public Form1()
{
InitializeComponent();
x1 = x2 = y1 = y2 = distancia = 0;
}
private void button1_Click(object sender, EventArgs e)
{
x1 = double.Parse(textBox1.Text);
y1 = double.Parse(textBox2.Text);
x2 = double.Parse(textBox3.Text);
y2 = double.Parse(textBox4.Text);
distancia = Math.Sqrt(Math.Pow((x2 - x1), 2) + Math.Pow((y2 - y1), 2));
label5.Text= "la distancia es = " + distancia;
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
label5.Text = " ";
}
}
}
Practica 4_2
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
double x, y, z, w, t1, t2, t3, t4 , f;
public Form1()
{
InitializeComponent();
x = y = z = w = t1=t2=t3=t4=f= 0;
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
x = double.Parse(textBox1.Text);
y = double.Parse(textBox2.Text);
z = double.Parse(textBox3.Text);
w = double.Parse(textBox4.Text);
t1 = (4 * Math.Pow(x, 2) * Math.Pow(y, 2));
t2 = Math.Sqrt(2 * z * w);
t3 = 4 * Math.Pow(x, 1.0 / 2.0);
t4 = t1 * t2;
f = Math.Pow(t4, 2) / t3;
label5.Text = "f = " + f;
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox1.Focus();
}
}
}
Practica 4_3
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
double z, w;
public Form1()
{
InitializeComponent();
z = w = 0;
}
private void button1_Click(object sender, EventArgs e)
{
w = double.Parse(textBox1.Text);
z= (1.0/Math.Sqrt(2*Math.PI)*Math.Exp(-w*w/2));
label1.Text = " z = " + z;
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label1.Text = " ";
textBox1.Focus();
}
}
}
No hay comentarios:
Publicar un comentario