martes, 24 de noviembre de 2009

practicas 11







PRACTICA 11 1 CONSOLA

PSEUDOCODIGO


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;>
{
for (C = 0; C <5>
{
if (num[R, C] > Mayor)
{
posR = R;
posC = C;
Mayor = num[R, C];
}
}
}
for (R = 0; R <>
{
for (C = 0; C <>
{
print num[R, C]);
}
print Mayor
print posR+1
print posC+1

FIN


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace PRACT_11_1_VAL_MAX_CONS

{

class Program

{

static void Main(string[] args)

{

int[,] num = { { 16, 22, 99, 4, 18 }, { -258, 4, 101, 5, 98 }, { 123, 21, 17, 2, 150 }, { 45, 78, 13, 65, 1 } };

int Mayor = num[0, 0];

int posR = 0, posC = 0, R, C;

for (R = 0; R <>

{

for (C = 0; C <>

{

if (num[R, C] > Mayor)

{

posR = R;

posC = C;

Mayor = num[R,C];

}

}

}

for (R = 0; R <>

{

for (C = 0; C <>

{

Console.Write("\t{0}", num[R, C]);

}

Console.WriteLine();

}

Console.WriteLine("El dato mayor es: {0}", Mayor);

Console.WriteLine("En el renglon: {0}", posR + 1);

Console.WriteLine("Y la columna: {0}", posC + 1);

Console.ReadKey();

}

}

}

WINDOW



PRACTICA11.2 CONSOLA

PSEUDOCODIGO

doublE sueldos[10,10]
double[] precio = {
1.20,2.50,3.90,4.60,5.20,6.30,7.45,8.69,9.12,10.50 };
int Nv, Art, N, sigue = 1;

do
{
print "Numero de vendedor:"

read Nv

print "Numero de articulo:"

read Art

print "Cantidad de articulo:"

read N

sueldos[Nv - 1, Art - 1] = sueldos[Nv - 1, Art - 1] + N * precio[Art - 1];

print "Presione 1 para continuar o 0 para calcular sueldos"
read sigue
}
while (sigue == 1);
{
int v, p;
double sum, salario;
for (v = 0; v < v =" v" sum =" 0;" p =" 0;" p =" p" sum =" sum" salario =" sum">



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

namespace practica_11_2_consola
{
class Program
{
static void Main(string[] args)
{
double [,]sueldo= new double[10,10];

double []precio={1.20,2.50,3.90,4.60,5.20,6.30,7.45,8.69,9.12,10.50};
double suma=0;
double salario;
int p;
int nv;
int art;
int n;
int v=0;
int sigue;
for (v = 0; v < p =" 0;" nv =" int.Parse(Console.ReadLine());" art =" int.Parse(Console.ReadLine());" n =" int.Parse(Console.ReadLine());" sigue =" int.Parse(Console.ReadLine());" sigue ="=" v =" 0;" suma =" 0;" p =" 0;" suma =" suma" salario =" suma" vendedor="{0}" sueldo="{0}">

WINDOWS

PRACTICA 11-3 CON

PSEUDOCODIGO

int ciudad [10, 29]
int ave, calle, AC, a, c, suige, posave=0, poscalle=0;
int mayor = 0;
do
{
do
{
PRINT "Introduce No. de Avenida"
READ ave
if(ave<1>10)
{
PRINT "ERRORO AL INTRODUCIR AVENIDA"
}
}

while(ave<1>10);
do
{
PRINT "Introduce No de Calle"
READ calle
if(calle<30>58)
{
PRINT "ERRORO AL INTRODUCIR LA CALLE"
}
}

while(calle<30>58);
PRINT "Introduce Numero de Accidentes"
READ AC
ciudad[ave-1,calle-30]=AC;
PRINT "Precione 1 Para Continuar O Cero Para Entrada de Datos"
READ suige
}
while(suige==1);
for (a = 0; a <= 9; a++) { for (c = 0; c <= 28; c++) { if (ciudad[a, c] > mayor)
{
mayor = ciudad[a, c];
posave = a;
poscalle = c;
}
}
}

PRINT "la primera interseccion mas peligrosas estaentre la avenida:
PRINT “la calle:”
PRINT “con numero de accindetes”
ciudad[posave,poscalle]=0;
mayor=0;

fin


WINDOWS

PRACTICA 11 4
PSEUDOCODIGO
int suma= 0, mayor= 0, np = 0, dia = 0;

int r, c;

string plantas[12];
int[,] produccion[13, 8];
for (r = 0; r < suma="0;" c =" 0;" suma =" suma" c =" 0;" suma =" 0;" r =" 0;" suma =" suma" r =" 0;"> mayor)
{
mayor = produccion[r, 7];
np = r + 1;
}
}
Print "Plantas mas productivas ", np + 1
Print "Produccion de la pantal mas productiva ", produccion[np, 7]
mayor = 0;
for (c = 0; c <> mayor)
{
mayor = produccion[12, c];
diap = c + 1;
}
}
Print "Dia con mayor produccion:"
switch(diap)
{
case 1: print "Lunes"
break;
case 2: print "Martes"
break;
case 3: print "Miercoles"
break;
case 4: print "Jueves"

break;
case 5: print "Viernes"
break;
case 6: print "Sabado"
break;
case 7: print "Domingo"
break;
}
Prin t"Mayor Produccion en un dia", mayor
FIN



using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace prac_11_4_cons

{

class Program

{

static void Main(string[] args)

{

int SUM = 0, MAY = 0, NP = 0, DIAPROD = 0;

int r, c;

string[] planta = new string[12];

int[,] PROD = new int[13, 8];

for (r = 0; r <>

{

Console.WriteLine("NOMBRE DE LA PLANTA {0}", r + 1);

planta[r] = Console.ReadLine();

SUM = 0;

for (c = 0; c <>

{

Console.WriteLine("PRODUCCION DE LA PLANTA {0}", r + 1);

Console.WriteLine("DIA {0}", c + 1);

PROD[r, c] = int.Parse(Console.ReadLine());

SUM = SUM + PROD[r, c];

}

PROD[r, 7] = SUM;

}

for (c = 0; c <>

{

SUM = 0;

for (r = 0; r <>

{

SUM = SUM + PROD[r, c];

}

PROD[12, c] = SUM;

}

for (r = 0; r <>

{

if (PROD[r, 7] > MAY)

{

MAY = PROD[r, 7];

NP = r + 1;

}

}

Console.WriteLine("Plantas mas productivas {0}", NP + 1);

Console.WriteLine("Produccion de la pantal mas productiva {0}", PROD[NP, 7]);

MAY = 0;

for (c = 0; c <>

{

if (PROD[12, c] > MAY)

{

MAY = PROD[12, c];

DIAPROD = c + 1;

}

}

Console.WriteLine("DIA CON MAYOR PRODUCCION:");

switch (DIAPROD)

{

case 1: Console.WriteLine("LUNES");

break;

case 2: Console.WriteLine("MARTES");

break;

case 3: Console.WriteLine("MIERCOLES");

break;

case 4: Console.WriteLine("JUEVES");

break;

case 5: Console.WriteLine("VIERNES");

break;

case 6: Console.WriteLine("SABADO");

break;

case 7: Console.WriteLine("DOMINGO");

break;

}

Console.WriteLine("LA MAYOR PRODUCCION EN EL DIA {0}", MAY);

Console.ReadKey();

}

}

}

PRACTICA 12

PSEUDOCODIGO

PSEUDOCODIGO

static void ImpriMemensaje (string Dato)

{
PRINT (Dato);
}
static void Main ()
{
string mensaje;
PRINT "INTRODUCE UN MENSAJE PARA LA NAVIDAD"
READ mensaje
ImpriMemensaje (mensaje);
ImpriMemensaje (mensaje);
ImpriMemensaje(mensaje);
FIN


PRACTICA 12 2 VISUAL
PSEUDOCODIGO
int N1, N2;
int suma()
{
return N1 + N2;
}
int multiplicacion()
{
return N1 * N2;
}
{
READ N1
READ N2
int R1 = suma();
int R2 = multiplicacion();
PRINT "Suma:" + R1
PRINT "Multiplicacion:" + R2
}
Fin