martes, 27 de octubre de 2009

Practica 8.3 Visual


PSEUDOCODIGO
int[] emax = new int[10];
int I, mayor;
PRINT("Introduce un munero entero");
READ emax[0]
mayor = emax[0];
for (I = 1; I < 10; I++)
{PRINT("Introduce dato{0}", I);
READ emax[I]
if (emax[I] > mayor)
{
mayor = emax[I];
}
}

PRINT("Lista de 10 numeros enteros");
for (I = 0; I < 10; I++)
{
PRINT(emax[I]);
}

PRINT("el valor maximo es {0}: ", mayor);
Console.ReadLine();















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[] corriente;
int[] resistencia;
int[] voltios;
int i;

public Form1()
{
InitializeComponent();

corriente = new int[10];
resistencia = new int[10];
voltios = new int[10];
i = 0;
}

private void button1_Click(object sender, EventArgs e)
{
if(i<10)
{
corriente[i]=int.Parse(textBox1.Text);
resistencia[i]=int.Parse(textBox2.Text);
voltios[i]=corriente[i]*resistencia[i];
textBox1.Clear();
textBox1.Focus();
textBox2.Clear();
textBox2.Focus();
i++;


}
else
{
textBox1.Clear();
textBox1.Enabled=false;
button1.Enabled=false;
textBox2.Clear();
textBox2.Enabled = false;

}
}

private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Add("Corriente Resistencia Voltios");
for (i=0;i<10;i++)
{

listBox1.Items.Add(corriente[i].ToString()+"\t\t"+ resistencia[i].ToString()+"\t\t"+voltios[i].ToString());
}
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{

}
}
}

No hay comentarios:

Publicar un comentario