viernes, 21 de mayo de 2010

Regularizacion

problema 1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[] nombres = new string[15];
double[,] ventas = new double[15, 12];
double[] totales = new double[15];
Random random = new Random();
double venta;
venta = 0;





double suma;
suma = 0;
int c = 0;
int r;
r = 0;
for (r = 0; r <= 14; r = r + 1) { suma = 0; Console.WriteLine("Nombre del encargado de la estacion " + (r + 1)); nombres[r] = Console.ReadLine(); for (c = 0; c <= 11; c = c + 1) { Console.WriteLine("produccion " + (r + 1) + ": " + (c + 1)); venta = (random.Next(1, 9)); ventas[r, c] = venta; suma = suma + ventas[r, c]; } totales[r] = suma; } double mayor = 0; int pesmayor = 0; for (r = 0; r <= 14; r = r + 1) { if (totales[r] > mayor)
{
mayor = totales[r];
}
}
Console.WriteLine("estacion produccion total");
for (r = 0; r <= 14; r++) { Console.WriteLine("" + nombres[r] + " " + totales[r]); } Console.WriteLine("estacion con mayor produccion" + nombres[pesmayor]); Console.WriteLine("produccion" + mayor); Console.ReadKey(); } } }
problema 1 pseudocodigo
1.inicio
nombre[15]string;
venta[15,13]double
totales[15]double
suma=0
for(r=0 to 14 step r++)
print "nombre del vendedor" R+1
Nombres[r]
for(c=0 to 12 step c++)
{
print "ventas" r+1,c+1
read ventas[r,c]
suma=suma+ventas[r,c]
}
totales[r]=suma
}
mayor=0 double
pesmayor=0 int
for(r=0 to 14 step r=r+1)
{
if (totales[r]>mayor)
}
mayor=totales[r]
}
}
print "nombre del vendedor venta total"
for(r=0 to 14 step r=r+1)
{
print nombres[r]," ", totales[r]
}
print "nombre del vendedor de mayor ventas" , nombre[posmayor]
print "monto de venta", mayor
fin

problema 1 visual


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

{
string[] nombre = new string[15];
double[,] ventas = new double[15, 13];
double[] totales = new double[15];
Random venta = new Random();
int r, c, posMayor;
double suma;
double mayor;

public Form1()
{
InitializeComponent();
r = 0;
c = 0;
posMayor=0;

}

private void button1_Click(object sender, EventArgs e)
{

if (r < r="=" enabled =" false;" r =" 0;" suma =" 0;" c =" 0;" suma =" suma" r =" 0;" salida =" nombre[r];" c =" 0;" salida =" salida" r =" 0;"> mayor)
{
mayor = totales[r];
posMayor = r;
}
}

listBox1.Items.Add("Nombre del vendedor con mayor venta: " + nombre[posMayor]);
listBox1.Items.Add("Monto total: " + mayor);

}
}

private void button4_Click(object sender, EventArgs e)
{
r = c = 0;
string[] nombre = new string[10];
double[,] ventas = new double[10, 30];
double[] totales = new double[10];
listBox1.Items.Clear();
textBox1.Enabled = true;
textBox1.Clear();
textBox1.Focus();

}
}
}


problema 2


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[] nombres = new string[10];
double[,] ventas = new double[10, 30];
double[] totales = new double[10];
Random random = new Random();
double venta;
venta = 0;





double suma;
suma = 0;
int c=0;
int r;
r = 0;
for (r = 0; r <= 9; r = r + 1) { suma = 0; Console.WriteLine("Nombre del vendedor " + (r + 1)); nombres[r]=Console.ReadLine(); for (c = 0; c <= 29; c = c + 1) { Console.WriteLine("ventas " + (r + 1) +": "+ (c + 1)); venta = (random.Next(1, 9)); ventas[r, c] = venta; suma = suma + ventas[r, c]; } totales[r] = suma; } double mayor = 0; int pesmayor = 0; for(r=0;r<=9;r=r+1) { if(totales[r]>mayor)
{
mayor=totales[r];
}
}
Console.WriteLine("NOmbre del vendedor venta total");
for (r = 0; r<= 9; r++ ) { Console.WriteLine("" + nombres[r] + " " + totales[r]); } Console.WriteLine("Nonmbre del vendedo de mayor ventas"+nombres[pesmayor]); Console.WriteLine("monto de venta"+mayor); Console.ReadKey(); } } }

problema 2 visual


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
{


string[] nombre = new string[10];
double[,] ventas = new double[10, 30];
double[] totales = new double[10];
Random venta = new Random();
int r, c, posMayor;
double suma;
double mayor;

public Form1()
{
InitializeComponent();
r = 0;
c = 0;
posMayor = 0;

}

private void button1_Click(object sender, EventArgs e)
{

if (r < r ="=" enabled =" false;" r =" 0;" suma =" 0;" c =" 0;" suma =" suma" r =" 0;" salida =" nombre[r];" c =" 0;" salida =" salida" r =" 0;"> mayor)
{
mayor = totales[r];
posMayor = r;
}
}

listBox1.Items.Add("Nombre del vendedor con mayor venta: " + nombre[posMayor]);
listBox1.Items.Add("Monto total: " + mayor);

}
}

private void button4_Click(object sender, EventArgs e)
{
r = c = 0;
string[] nombre = new string[10];
double[,] ventas = new double[10, 30];
double[] totales = new double[10];
listBox1.Items.Clear();
textBox1.Enabled = true;
textBox1.Clear();
textBox1.Focus();

}
}
}
problema 2 pseudocodigo

1.inicio
nombre[10]string;
venta[10,30]double
totales[10]double
suma=0
for(r=0 to 9 step r++)
print "nombre del vendedor" R+1
Nombres[r]
for(c=0 to 29 step c++)
{
print "ventas" r+1,c+1
read ventas[r,c]
suma=suma+ventas[r,c]
}
totales[r]=suma
}
mayor=0 double
pesmayor=0 int
for(r=0 to 9 step r=r+1)
{
if (totales[r]>mayor)
}
mayor=totales[r]
}
}
print "nombre del vendedor venta total"
for(r=0 to 9 step r=r+1)
{
print nombres[r]," ", totales[r]
}
print "nombre del vendedor de mayor ventas" , nombre[posmayor]
print "monto de venta", mayor
fin

problema 3

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[] avion = new int[10];
int opcion;
int i;
int Num_Asiento;


for (i = 0; i < opcion =" int.Parse(Console.ReadLine());" num_asiento =" int.Parse(Console.ReadLine());" num_asiento =" int.Parse(Console.ReadLine());" opcion =" int.Parse(Console.ReadLine());" opcion ="=" style="color: rgb(255, 102, 0);font-size:180%;" >

problema 3 pseudocodigo

1. inicio
avion[10]int
noasiento int
opcion int
i int
for (i+0 to 9 step i=i+1)
{
avion[i]=0
}
do
print " 1 primera clase, 2 economica"
print " seleccione opcion"
read opcion
switch (opcion)
case 1:
print "numero de asiento entre 1 y 5"
read no asiento
if (avion[noasiento-1]=1)
{
print "no disponible"
}
else
{
avion[noasiento-1]=1
print "no asiento", noasiento
print "primera clase
}
break;
case 2:
print "numero de asiento 6 y 10"
read noasiento
if(avion[noasiento-1]==1
{
print "no disponible"
}
else
{
avion[noasiento-1]==1)
print "no asiento", noasiento
print "clase economica"
break;
default: print "opcion equivocada"
}
print "presione 0 para salir 1 para continuar
read opcion
}
while(opcion==1)
fin
Problema 3 visual



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[] avion = new int[10];
int opcion;
int i;
int Num_Asiento;


public Form1()
{
InitializeComponent();
listBox1.Items.Add("Presione 1 para primera clase 2 para economica");
}

private void button1_Click(object sender, EventArgs e)
{
opcion=int.Parse(textBox1.Text);
switch (opcion)
{
case 1:
listBox1.Items.Add("Numero de asiente entre 1 y 5");
break;
case 2:
listBox1.Items.Add("Numero de asiento entre 6 y 10");
break;
}





}

private void button2_Click(object sender, EventArgs e)
{

Num_Asiento = int.Parse(textBox2.Text);
for (i = 0; i < 10; i++)
{
avion[i] = 0;



}







}

private void button3_Click(object sender, EventArgs e)
{

if (avion[Num_Asiento - 1] == 1)
{
listBox1.Items.Add(" no disponible");
}
else
{
avion[Num_Asiento - 1] = 1;
listBox1.Items.Add("No. asiento" + Num_Asiento);
listBox1.Items.Add("Primera clase");
}







}
}
}

No hay comentarios:

Publicar un comentario