Vous êtes sur la page 1sur 2

Arrays Prática

public partial class Form1 : Form


{
string[] exames = {"",""};
int[] notas = { -1, -1 };
int pos;

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)


{
exames[0] = "N/D";
lbExamesDisponiveis.Text = lista.Items.Count.ToString();
}

private void bt1Exame_Click(object sender, EventArgs e)


{
//exames[0] = lista.SelectedItem.ToString();
novoExame(0);
}

private void bt2Exame_Click(object sender, EventArgs e)


{
//exames[1] = lista.SelectedItem.ToString();
novoExame(1);
}

private void btVerExames_Click(object sender, EventArgs e)


{
lb1Exame.Text = exames[0].ToString();
lb2Exame.Text = exames[1].ToString();
}

void novoExame(int x)
{
exames[x] = lista.SelectedItem.ToString();
}

1 de 2
private void btGravar_Click(object sender, EventArgs e)
{
pos = Convert.ToInt32(txNota1.Text);
pos = Convert.ToInt32(txNota2.Text);
notas[pos - 1] = Convert.ToInt32(txNota1.Text);
notas[pos - 1] = Convert.ToInt32(txNota2.Text);
}

string estatistica()
{
int n1 = Convert.ToInt32(txNota1.Text);
int n2 = Convert.ToInt32(txNota2.Text);
string info = txExamesAprovados.Text;

if (n1 > 700 && n2 > 700)


info = "2";

else if ((n1 > 700 && n2 <= 700) || (n1 <= 700 && n2 > 700))
info = "1";

return info;
}

private void btEstatistica_Click(object sender, EventArgs e)


{
estatistica();
}
}

2 de 2

Vous aimerez peut-être aussi