![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj557zlR3s08fNK9wM7LW8DQXkQYCXWeUD1AjocjjUTJgAxR2H1TfuHfuggRL2f5KhfagMZDxVQE_MDCxwru7yj8DwqD8GtyLmS5gZzFywAK_5KgaZkrIUA2f28CtWpo-gr-9okwNeLsgu7/s400/visual+examen.jpg)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class frmExamen : Form
{
int[,] Matriz;
string[] Nombres;
int R, C;
int M, N,renglon;
int mayor = 0;
public frmExamen()
{
InitializeComponent();
R = C = 0;
M = N = 0;
}
private void button1_Click(object sender, EventArgs e)
{
M = int.Parse(txtplantas.Text);
N = int.Parse(txtdias.Text);
Nombres = new string[M];
Matriz = new int[M, N + 1];
txtplantas.Enabled = false;
txtdias.Enabled = false;
button1.Enabled = false;
txtnplanta.Text = (R + 1).ToString();
textBox4.Text = (C + 1).ToString();
txtproduccion.Focus();
}
private void button2_Click(object sender, EventArgs e)
{
if (R < M && C < N)
{
Matriz[R, C] = int.Parse(txtproduccion.Text);
Nombres[R] = txtplantan.Text;
C++;
txtplantan.Enabled = false;
if (C == N)
{
C = 0;
R++;
txtplantan.Enabled = true;
txtplantan.Clear();
}
if (R != M)
{
txtnplanta.Text = (R + 1).ToString();
textBox4.Text = (C + 1).ToString();
txtproduccion.Clear();
txtproduccion.Focus();
}
else
{
txtnplanta.Enabled = false;
textBox4.Enabled = false;
txtproduccion.Enabled = false;
txtplantan.Enabled = false;
MessageBox.Show("Todos los datos fueron introducidos");
}
}
}
private void button3_Click(object sender, EventArgs e)
{
int Suma = 0;
lstagregar.Items.Add("No.Planta Planta Produccion semanal");
for (R = 0; R < M; R++)
{
Suma = 0;
for (C = 0; C < N; C++)
{
Suma += Matriz[R, C];
}
Matriz[R, C] = Suma;
}
for (R = 0; R < M; R++)
{
lstagregar.Items.Add((R + 1).ToString() + " " + Nombres[R] + " " + Matriz[R, N].ToString());
}
for (R = 0; R < M; R++)
{
Suma = Matriz[R, N];
if (Suma > mayor)
{
mayor = Matriz[R, N];
renglon = R;
}
}
lblNumplant.Text=" El numero de Planta con mayor produccion es:"+ (renglon + 1);
lblNombplant.Text="Nombre de la Planta:" + Nombres[renglon];
lblMayorprod.Text="Total de la produccion es:"+ mayor;
}
private void cmdSalida_Click(object sender, EventArgs e)
{
Close();
}
}
}
DIAGRAMA DE FLUJO DE EXAMEN
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUSYFpF5kdlTWguVUgFDB5t5JKv6FAory8iQnJ9-6bRDdxYBcHwvWTZSHPoKoPrr7sLWPyYr8zHZDBTrZ64fZRxVZduHBeCoJqKZu1QiftmocpYXhNT9XRTFPkw_b5dBLkMvlA0sT1M83d/s400/diagrama+examen+parte+1.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRWLeppMwYOQg6dRlToImfZ3MzNEoBDo_br1mGDWseUxyJRCHY8Imik0kUBTc7qEiUdGs3Z19JysBW37fZNVtIbap1koFsVS7G54xz-p5neWxce6Lkw1lr9nZYr_Bq1cm01DqzNpbkO-t7/s400/diagrama+examen+parte+2.jpg)
using System;
using System.Collections.Generic;
using System.Text;
namespace examen
{
class Program
{
static void Main(string[] args)
{
string[] nombres = new string[8];
int[,] produccion = new int[8, 7];
int suma=0;
int mayor = 0;
int mayor_planta=0;
Console.WriteLine("Examen");
for (int i = 0; i < 8; i++)
{
Console.Write("Captura nombre de la planta {0} ",i+1);
nombres[i] = Console.ReadLine();
}
for ( int j=0; j<8;j++){
Console.Clear();
Console.WriteLine("Planta {0}", nombres[j]);
for (int a = 0; a < 7; a++)
{
Console.Write("Captura la produccion dia {0} :", a + 1);
produccion[j, a] = System.Int32.Parse(Console.ReadLine());
}
Console.Clear();
}
//for (int i = 0; i < 8; i++)
//{
// Console.Write("{0}", nombres[i]);
//}
for (int j = 0; j < 8; j++)
{
suma = 0;
for (int a = 0; a < 7; a++)
{
Console.WriteLine("dia{0} produccion {1}", a + 1, produccion[j, a]);
suma = suma + produccion[j, a];
}
Console.WriteLine("\nProduccion total de planta {0} : {1} ", nombres[j], suma);
produccion[j,6]=suma;
}
Console.ReadLine();
Console.Clear();
mayor=0;
for (int j = 0; j < 8; j++)
{
if( produccion[j,6] < mayor){
mayor = produccion[j, 6];
mayor_planta=j;
}
}
Console.WriteLine("La planta con mayor produccion es {0}", nombres[mayor_planta]);
Console.ReadLine();
Console.WriteLine("Presione Intro para salir");
}
}
}
1 comment:
esta bien tu blog
Post a Comment