miércoles, 9 de diciembre de 2009

Practica 11.1 Visual

[11_1.jpg]

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 Valor_Maximo_W
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
int[,] num = { { 16, 22, 99, 4, 18 }, { -258, 4, 101, 5, 98 }, { 105, 6, 15, 2, 45 }, { 33, 88, 72, 16, 3 } };
int Mayor = num[0, 0];
int posR = 0, posC = 0, R, C;

for (R = 0; R < 4; R++)
{
for (C = 0; C < 5; C++)
{
if (num[R, C] > Mayor)
{
posR = R;
posC = C;
Mayor = num[R, C];
}
}
}
for (R = 0; R < 4; R++)
{
for (C = 0; C < 5; C++)
{
listBox1.Items.Add(num[R, C]);

}

}
MessageBox.Show("\nEl dato mayor es: " + Mayor +"\n"+ "En el renglon: " + posR + 1 +"\n"+ "Y la columna: " + posC + 1);
}

private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}

private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}

No hay comentarios:

Publicar un comentario