Escolar Documentos
Profissional Documentos
Cultura Documentos
Cdigo (C#)
using
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Threading.Tasks;
System.Windows.Forms;
namespace Exer_Revisao_03
{
public partial class Form1 : Form
{
int i,j;
int numalunos = 4;
double[] Notas = new double[10];
string[] Nome = new string[10];
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//Inserir Nomes dos alunos e Classificao
listBox1.Items.Clear();
Pgina 1 de 3
2013/2014
2013/2014
}
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//Mostrar Classificao do aluno na Label1
int indice = listBox1.SelectedIndex;
//MessageBox.Show(Convert.ToString(a), "Sair", MessageBoxButtons.OK,
MessageBoxIcon.Information);
label1.Text = Convert.ToString(Notas[indice]);
label5.Text = (Nome[indice]);
}
private void button2_Click(object sender, EventArgs e)
{
//Boto Fechar
if (MessageBox.Show("Sair da Aplicao?", "Sair",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
== DialogResult.Yes)
{
//Application.Exit();
this.Close();
}
}
private void button3_Click(object sender, EventArgs e)
{
//Calcular Mdia
double soma, media;
soma = 0;
for (i = 0; i < numalunos; i++)
{
soma = soma + Notas[i];
}
media = soma / numalunos;
label6.Text = "Mdia: " + Convert.ToString(media);
}
private void button4_Click(object sender, EventArgs e)
{
//Nota mxima
double maximo;
int indice = 0;
Pgina 2 de 3
2013/2014
maximo = -1;
for (i = 0; i < numalunos; i++)
{
if (Notas[i] > maximo)
{
maximo = Notas[i];
indice = i;
}
}
Pgina 3 de 3