20091109

PRACTICA 8.1ARREGLO LLAMADO TEMP.(visual)



CODIGO EJECUTABLE DEL PROGRAMA 8.1. A CONTINUACION


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int[] temp;
int I, suma, P;
public Form1()
{
InitializeComponent();
temp = new int[8];
I = suma = P = 0;
listBox1.Items.Add("");
}
private void button1_Click(object sender, EventArgs e)
{
if (I < 8)
{
temp[I] = int.Parse(textBox1.Text);
suma = suma + temp[I];
listBox1.Items.Add(temp[I]);
textBox1.Clear();
textBox1.Focus();
I++;
}
else
{
textBox1.Clear();
textBox1.Enabled = false;
button1.Enabled = false;
}
}
private void button2_Click(object sender, EventArgs e)
{
P = suma / 8;
listBox1.Items.Add("Promedio=" + P.ToString());
}
private void button3_Click(object sender, EventArgs e)
{
I = 0;
textBox1.Clear();
listBox1.Items.Clear();
}
private void button4_Click(object sender, EventArgs e)
{
Close();
}
}
}

No hay comentarios:

Publicar un comentario