viernes, 18 de diciembre de 2009

PRACTICAS 13

practica 13.1 consola
PSEUDOCODIGO
double ancho, largo;
public rectangulo()
{
ancho = 0;
largo = 0;

}
public void Asignardatos(float w,float h)
{
ancho=w;
largo=h;

}
public void Asignarancho(float w)
{ancho=w;

}
public void Asignarlargo(float h)
{
largo=h;
}
public double Obtenerancho()
{
return ancho;

}
public double Obtenerlargo()
{
return largo;
}
public double Area()
{
return largo*ancho;
}
public double Perimetro()
{
return 2*(largo+ancho);

}


practica 13.1 windows


practica 13.2 consola
int ide;
double[] calif;
int total;


public estudiante()
{
ide=0;
calif=new FLOAT[5];
total=0;
}
public void introduceide(int nc)
{
ide=nc;
}
public void introducecalif(FLOAT nota)
{
calif[total]=nota;
total++;
}
public FLOAT promedio()
{
double suma=0.0f;
int i;
for i=0 step total i=i+1
{
suma=suma+calif[i];
}
return suma/total;




PRACTICA 13_2 WIN



martes, 8 de diciembre de 2009

practicas extra unidad 3



CONSOLA

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
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double[] valor = { 5, 7, 8, 2, 3 };
int i;
double maximo = valor[0];
double minimo = valor[0];
double intervalo = 0;

for (i = 0; i <> maximo)
{
maximo = valor[i];
}

if (valor[i] < minimo =" valor[i];" intervalo="maximo-minimo;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZYrm6_QEFeEYy5XzQ8GFbHP0nYXF3YWeENH75ARRqqQ8crau_pmj-WOwQp4zKi02c4P2h8Xm0H8JbI6D2ZNfHna-fXRLksl4gfiBPkZONtKlvEzo5vOkUmdwEmkYMzJ1uQ8qqRqTjXQGz/s1600-h/med+cuad+visual+2.jpg">CONSOLA SEGUNDO PROBLEMA
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EXAMEN2doCONSOLA
{
class Program
{
static void Main(string[] args)
{
int[] valor = new int[5];
int i = 0;
double mgeo = 0;
double total = 0;
Console.WriteLine("introduce los siguientes datos");
for (i = 0; i < total =" Math.Pow(valor[i]," mgeo =" Math.Sqrt(10" i =" 0;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZYrm6_QEFeEYy5XzQ8GFbHP0nYXF3YWeENH75ARRqqQ8crau_pmj-WOwQp4zKi02c4P2h8Xm0H8JbI6D2ZNfHna-fXRLksl4gfiBPkZONtKlvEzo5vOkUmdwEmkYMzJ1uQ8qqRqTjXQGz/s1600-h/med+cuad+visual+2.jpg">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 media_geometrica
{
public partial class Form1 : Form
{
int[] x = new int[10];
double multip = 0, GM;
int i = 0;
public Form1()
{
multip = GM = 0;
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
if (i< 10)
{
x[i] = int.Parse(textBox1.Text);
listBox1.Items.Add(x[i]);
textBox1.Clear();
textBox1.Focus();
i++;
}
}

private void button2_Click(object sender, EventArgs e)
{
for (i = 0; i <5; i++)
{
listBox1.Items.Add("dato" + i.ToString() + ": " + x[i].ToString());

multip = Math.Pow(x[i], 5);
}
GM = Math.Sqrt(5 / multip);

listBox1.Items.Add("El valor cuadratico medio es" + GM.ToString());
}

private void Form1_Load(object sender, EventArgs e)
{

}
}
}

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