public partial class Form1 : Form
{
int push = 0;
int pop = 0;
ExaU3 pila = new ExaU3();
public Form1()
{
InitializeComponent();
}
private void buttonPoner_Click(object sender, EventArgs e)
{
push++;
if (push == 1)
{
pila.metodo1(1);
plato3.Visible = true;
}
if (push == 2)
{
pila.metodo1(2);
plato2.Visible = true;
}
if (push == 3)
{
pila.metodo1(3);
plato1.Visible = true;
}
if (push > 3)
{
MessageBox.Show("No hay lugar para mas platos");
}
}
private void buttonQuitar_Click(object sender, EventArgs e)
{
pop++;
if (pop == 1)
{
MessageBox.Show("Se quitará el Plato " + pila.metodo2() + " de la pila");
plato1.Visible = false;
}
if (pop == 2)
{
MessageBox.Show("Se quitará el Plato " + pila.metodo2() + " de la pila");
plato2.Visible = false;
}
if (pop == 3)
{
MessageBox.Show("Se quitará Plato " + pila.metodo2() + " de la pila");
plato3.Visible = false;
}
if (pop > 3)
{
MessageBox.Show("No hay mas platos en la pila");
}
}
}
}