Escolar Documentos
Profissional Documentos
Cultura Documentos
DE INFORMTICA DE
GESTO
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_02
{
public partial class Form1 : Form
{
int i;
double[] Notas = new double[10];
public Form1()
{
InitializeComponent();
}
private void button3_Click(object sender, EventArgs e)
{
//Boto Fechar
if (MessageBox.Show("Sair da Aplicao?", "Sair",
Pgina 1 de 3
DE INFORMTICA DE
GESTO
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
== DialogResult.Yes)
{
//Application.Exit();
this.Close();
}
}
private void button1_Click(object sender, EventArgs e)
{
//Inserir Notas
listBox1.Items.Clear();
for (i=0;i<10;i++)
{
Notas[i] = Convert.ToDouble(Microsoft.VisualBasic.Interaction.InputBox("Introduza a nota",
"Notas", "0", 100, 200));
int x = i + 1;
listBox1.Items.Add("Nota do " + x + " Aluno: " + Notas[i]);
}
}
private void button4_Click(object sender, EventArgs e)
{
//Mostrar Notas
listBox1.Items.Clear();
for (i = 0; i < 10; i++)
{
int x = i + 1;
listBox1.Items.Add("Nota do " + x + " Aluno: " + Notas[i]);
}
}
private void button2_Click(object sender, EventArgs e)
{
//Limpar ListBox;
listBox1.Items.Clear();
}
private void button5_Click(object sender, EventArgs e)
{
//Calcular Mdia
double soma, media;
soma = 0;
for(i=0;i<10;i++)
{
soma = soma + Notas[i];
}
media = soma / 10;
listBox1.Items.Clear();
listBox1.Items.Add("Mdia das Notas dos Alunos: " + media);
}
private void button6_Click(object sender, EventArgs e)
{
Pgina 2 de 3
DE INFORMTICA DE
GESTO
//Nota mxima
double maximo;
maximo = -1;
for (i = 0; i < 10; i++)
{
if (Notas[i]>maximo)
maximo=Notas[i];
}
listBox1.Items.Clear();
listBox1.Items.Add("Nota mxima: " + maximo);
}
}
listBox1.Items.Clear();
listBox1.Items.Add("Nota mnima: " + minimo);
Pgina 3 de 3