20091109

PRACTICA 8.2 ARREGGLO LLAMADO EMAX(visual)





Del ejercicio 8.1 para el inciso a y b es el mismo codigo eso se entedio durante la clase., si hay aogun problema con esto haganmelo saber,


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[] Emax = new int[10];
int I, mayor, pos = 0;
public Form1()
{
InitializeComponent();
I = 0;
listBox1.Items.Add("");
}
private void button1_Click(object sender, EventArgs e)
{
if (I <>
{
Emax[I] = int.Parse(textBox1.Text);
if (I == 0)
{ mayor = Emax[0];
}
textBox1.Focus(); textBox1.Clear(); listBox1.Items.Add(I.ToString() + ":\t" + Emax[I].ToString()); if (Emax[I] > mayor)
{
mayor = Emax[I];
pos = I;
}
I++;
}
else
{
button1.Enabled = false;
}
}
private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Add ("El valor maximo es: " + mayor.ToString());
listBox1.Items.Add ("Posicion numero: " + pos.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();
}
}
}


A continuacion el codigo en ejecutable visual del inciso c).





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[] Emax = new int[10];
int I, mayor, pos = 0;
public Form1()
{
InitializeComponent();
I = 0;
listBox1.Items.Add("");
}
private void button1_Click(object sender, EventArgs e)
{
if (I < i ="="" mayor =" Emax[0];" mayor =" Emax[I];" pos =" I;" enabled =" false;" i =" 0;">

No hay comentarios:

Publicar un comentario