jueves, 5 de noviembre de 2009

PRACTICAS 10

10-1 CONSOLA


class Program

{

static void Main(string[] args)

{

double[] pendiente = { 17.24, 25.63, 5.94, 33.92, 3.71, 32.84, 35.93, 18.24, 6.92 };

double mayor = pendiente[0];

double menor = pendiente[0];

int i;

Console.WriteLine("Pendientes:");

for(i=1;i<=8;i=i+1)

{

Console.WriteLine(pendiente[i]);

if(pendiente[i]>mayor)

{mayor=pendiente[i];

}

if(pendiente[i]

{

menor=pendiente[i];

}}

Console.WriteLine("\nDato Mayor: {0}",mayor);

Console.WriteLine("Dato Menor: {0}", menor);

Console.ReadKey();

}

}

}



PRACTICA 10-1 WINDOWS

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

double[] pendiente = { 17.24, 25.63, 5.94, 33.92, 3.71, 32.84, 35.93, 18.24, 6.92 };

double mayor = pendiente[0];

double menor = pendiente[0];

int i;

listBox1.Items.Add("Pendientes:");

for (i = 1; i <= 8; i = i + 1)

{

listBox1.Items.Add(pendiente[i]);

if (pendiente[i] > mayor)

{

mayor = pendiente[i];

}

if (pendiente[i] <>

{

menor = pendiente[i];

}

}

listBox1.Items.Add("Dato Mayor:"+ mayor);

listBox1.Items.Add("Dato Menor:" + menor);

}

private void button2_Click(object sender, EventArgs e)

{

listBox1.Items.Clear();

}

private void button3_Click(object sender, EventArgs e)

{

Close();

}

}

}
NO PUDE SUBIR LA IMAGEN
PRACTICA 10.2

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace practica10_B_consola

{

class Program

{

static void Main(string[] args)

{

int []resistencia = {16, 27, 39, 56, 81};

int total=0;

int []corriente=new int[5];

int []potencia = new int [5];

int i;

for (i=0; i<5;>

{

Console.WriteLine("INTRODUCE LA CORRIENTE", i+1);

corriente[i]=int.Parse(Console.ReadLine());

potencia[i] = resistencia[i] * corriente[i] * corriente[i];

total=total+potencia[i];

}

Console.WriteLine("RESISTENCIA CORRIENTE POTENCIA");

Console.WriteLine("___________________________________________");

for (i=0; i<5;>

{

Console.WriteLine("{0} {1} {2}", resistencia[i], corriente[i], potencia[i]);

}

Console.WriteLine( "TOTAL: {0}", total);

Console.ReadLine();

}

}

}

WINDOWS

public partial class Form1 : Form

{

int[] resistencia = { 16, 27, 39, 56, 81 };

int[] corriente;

int[] potencia;

int total, i;

public Form1()

{

InitializeComponent();

resistencia = new int[] { 16, 27, 39, 56, 81 };

corriente = new int[5];

potencia = new int[5];

total = i = 0;

listBox1.Items.Add("Corriente:");

}

private void button1_Click(object sender, EventArgs e)

{ if (i <>

{

corriente[i] = int.Parse(textBox1.Text);

listBox1.Items.Add("");

listBox1.Items.Add(corriente[i]);

textBox1.Clear();

textBox1.Focus();

i++;

}

else

{

button1.Enabled = false;

textBox1.Enabled = false;

}

}

private void button2_Click(object sender, EventArgs e)

{

listBox1.Items.Clear();

for (i = 0; i <= 4; i = i + 1)

{

potencia[i] = resistencia[i] * (corriente[i] * corriente[i]);

total = total + potencia[i];

}

listBox1.Items.Add("Resistencia Corriente Potencia");

listBox1.Items.Add("----------------------------------");

for (i = 0; i <= 4; i = i + 1)

{

listBox1.Items.Add("" + resistencia[i] + "\t\t" + ....

corriente[i] + "\t\t" + potencia[i]);

}

listBox1.Items.Add("");

listBox1.Items.Add("\t Total: " + total.ToString());

}

private void button3_Click(object sender, EventArgs e)

{i = 0;

textBox1.Clear();

textBox1.Enabled = true;

button1.Enabled = true;

listBox1.Items.Clear();

}

private void button4_Click(object sender, EventArgs e)

{ Close();


PRACTICA 10.3


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace practica10_c_consola

{

class Program

{

static void Main(string[] args)

{

double[,] voltaje = new double[3, 5];

int cl = 0, c2 = 0;

int r, c;

for (r = 0; r <>

{

for (c = 0; c <>

{

Console.WriteLine("VOLTAJES: [{0},{1}]", r, c);

voltaje[r, c] = double.Parse(Console.ReadLine());

}

}

for (r = 0; r <>

{

for (c = 0; c <>

{

if (voltaje[r, c] <>

{

cl = cl + 1;

}

else

{

if (voltaje [r, c] >= 60)

{

c2 = c2 + 1;

}

}

}

}

Console.WriteLine("No de VOLTAJES <60:>, cl);

Console.WriteLine("No de VOLTAJES >=60: {0}", c2);

Console.ReadKey();

}

}

}


WINDOWS
public partial class Form1 : Form

{

double[,] voltajes;

int r, c;

int c1, c2;

public Form1()

{

InitializeComponent();

voltajes = new double[3, 5];

r = c = c1=c2=0;

label1.Text = "Introduce Voltaje :";

}

private void button1_Click(object sender, EventArgs e)

{

label1.Text = "Introduce Voltaje :";

if (r <>

{

if (c <>

{

voltajes[r, c] = double.Parse(textBox1.Text);

listBox1.Items.Add("Voltaje [ " + r.ToString() + "," + c.ToString() + "]:" + voltajes[r, c].ToString());

c++;

textBox1.Clear();

textBox1.Focus();

}

else

{

r++;

c = 0;

}

}

}

private void button2_Click(object sender, EventArgs e)

{

for (r = 0; r <>

{

for (c = 0; c <>

{

if (voltajes[r, c] <>

{

c1 = c1 + 1;

}

else

{

if (voltajes[r, c] >= 60)

{

c2 = c2 + 1;

}

}

}

}

listBox1.Items.Add("Numero De Voltajes <>

listBox1.Items.Add("");

listBox1.Items.Add("Numero De Voltajes>=60 Es:" + c2.ToString());

}

private void button3_Click(object sender, EventArgs e)

{

listBox1.Items.Clear();

textBox1.Clear();

}

private void button4_Click(object sender, EventArgs e)

{

Close();

}

}

}

NO PUDE SUBIR LA IMAGEN

No hay comentarios:

Publicar un comentario