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 numero11
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Variables
int tmp, i, j, LI, LS;
//Arreglos
int[] n = new int[4];
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
//Entrada
private void textBox1_TextChanged(object sender, EventArgs e)
{
n[0] = int.Parse(textBox1.Text);
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
n[1] = int.Parse(textBox2.Text);
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
n[2] = int.Parse(textBox3.Text);
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
n[3] = int.Parse(textBox4.Text);
}
//Proceso y salida
private void button1_Click(object sender, EventArgs e)
{
LI = 0;
LS = n.Length - 1;
for (i = LI; i <= LS - 1; i++)
{
for (j = LI; j <= LS - 1; j++)
{
if (n[j] > n[j + 1])
{
tmp = n[j];
n[j] = n[j + 1];
n[j + 1] = tmp;
}
}
}
textBox5.Text = n[0].ToString();
textBox6.Text = n[1].ToString();
textBox7.Text = n[2].ToString();
textBox8.Text = n[3].ToString();
}
}
}
No hay comentarios:
Publicar un comentario
Nota: solo los miembros de este blog pueden publicar comentarios.