lunes, 12 de octubre de 2009

PRACTICAS 5



PRACTICA 5.1
PRACTICA 5.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 practica_5._1_visual

{

public partial class Form1 : Form

{

double celcius, inc, fah,n, contador;

public Form1()

{

contador = 1.0;

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

celcius = double.Parse(textBox1.Text);

n = double.Parse(textBox2.Text);

inc = double.Parse(textBox3.Text);

listBox1.Items.Add("CELSIUS FAHRENHEIT");

while (contador <= n)

{

fah= (9.0/5.0)* celcius+ 32;

listBox1.Items.Add(celcius.ToString() + " = " + fah.ToString());

celcius=celcius+inc;

contador = contador + 1;

}

}

private void button2_Click(object sender, EventArgs e)

{

textBox1.Clear();

textBox2.Clear();

textBox3.Clear();

listBox1.Items.Clear();

}

private void button3_Click(object sender, EventArgs e)

{

Close();

}

private void Form1_Load(object sender, EventArgs e)

{

}

}

}



Practica5.1 consola

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace PRACTICA5._1_CONSOLA

{

class Program

{

static void Main(string[] args)

{

double c, f,incr;

int conv,contador=1;

Console.WriteLine(" introduce la temperatura en grados celsius");

c = double.Parse(Console.ReadLine());

Console.WriteLine(" introduce la cantidad de conversiones

que deseas realizar");

conv = int.Parse(Console.ReadLine());

Console.WriteLine(" introduce los incrementos");

incr = double.Parse(Console.ReadLine());

Console.WriteLine("la temperatura en grados fahrenheit es");

while (contador <= conv)

{

f=(9.0/5.0)* c + 32;

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

c = c + incr;

contador= contador + 1;

{

}

}

Console.ReadKey();

}

}

}


PRACTICA 5.2 A 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 _5._2_A_VISUAL

{

public partial class Form1 : Form

{

int c1;

public Form1()

{

c1 = 0;

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

c1 = int.Parse(textBox1.Text);

if (c1 <> 100)

{

textBox1.Enabled = false;

}

else

{

listBox1.Items.Add(c1);

}

}

private void button2_Click(object sender, EventArgs e)

{

textBox1.Enabled = true;

textBox1.Clear();

listBox1.Items.Clear();

}

private void button3_Click(object sender, EventArgs e)

{

Close();

}

private void Form1_Load(object sender, EventArgs e)

{

}

}

}


Practica 5.2 a consola


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace practica5._2consola

{

class Program

{

static void Main(string[] args)

{

int cl;

do{

Console.WriteLine("introduce la calificacion");

cl= int.Parse(Console.ReadLine());

Console.WriteLine("la calificacion:{0}",cl);

}

while(cl>=0 && cl<=100);

Console.Read();

}

}

}

PRACTICA 5.2 B VISUAL

PRACTICA 5.2 B 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 _5._2_b_visual

{

public partial class Form1 : Form

{

int c1, cod = 999;

public Form1()

{

c1 = 0;

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

c1 = int.Parse(textBox1.Text);

if (c1 == cod)

Close();

if (c1 <> 100)

{

textBox1.Enabled = false;

listBox1.Items.Add("ESTA CALIFICACION ES INCORRECTA, VERIFIQUE");

}

else

{

listBox1.Items.Add(c1);

}

}

private void button2_Click(object sender, EventArgs e)

{

textBox1.Enabled = true;

textBox1.Clear();

listBox1.Items.Clear();

}

private void button3_Click(object sender, EventArgs e)

{

Close();

}

private void Form1_Load(object sender, EventArgs e)

{

}

}

}




Practica 5.2 b consola


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace practica5._2_b_consola

{

class Program

{

static void Main(string[] args)

{

int cl;

do{

Console.WriteLine("introduce la calificacion");

cl= int.Parse(Console.ReadLine());

Console.WriteLine("la calificacion:{0}",cl);

if (cl <= 0 || cl >= 100)

Console.WriteLine("esta calificacion es invalida");

}

while(cl>=0 && cl<=100);

Console.Read();

}

}

}

PRACTICA 5.2 C VISUAL


PRACTICA 5.2 C 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 _5._2_c_visual

{

public partial class Form1 : Form

{

int c1, cod = 999;

public Form1()

{

c1 = 0;

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

c1 = int.Parse(textBox1.Text);

if (c1 == cod)

Close();

if (c1 <> 100)

{

textBox1.Enabled = false;

listBox1.Items.Add("ESTA CALIFICACION ES INCORRECTA, VERIFIQUE");

}

else

{

listBox1.Items.Add(c1);

}

}

private void button2_Click(object sender, EventArgs e)

{

textBox1.Enabled = true;

textBox1.Clear();

listBox1.Items.Clear();

}

private void button3_Click(object sender, EventArgs e)

{

Close();

}

private void Form1_Load(object sender, EventArgs e)

{

}

}

}


Practica 5.2 c consola


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace practica5._2_c_consola

{

class Program

{

static void Main(string[] args)

{

int cl;

do{

Console.WriteLine("introduce la calificacion");

cl= int.Parse(Console.ReadLine());

Console.WriteLine("la calificacion:{0}",cl);

if (cl <> 100)

Console.WriteLine("esta calificacion es invalida");

}

while (cl != 999);

Console.Read();

}

}

}

Practica 5.2 d consola


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace practica_5._2_d_consola

{

class Program

{

static void Main(string[] args)

{

int cl, contador = 1;

do

{

Console.WriteLine("introduce la calificacion");

cl = int.Parse(Console.ReadLine());

while (contador == 5)

{

Console.WriteLine("la calificacion:{0}", cl);

Console.Read();

}

if (cl <= 0 || cl >= 100)

Console.WriteLine("esta calificacion es invalida");

contador = contador + 1;

{

}

}

while (cl >= 0 && cl <= 100);

Console.Read();

}

}

}



Practica 5.3consola



using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace Practica_5_3

{

class Program

{

static void Main(string[] args)

{

double Icelsius, Fcelsius, INC, Fah, ValorI;

Console.WriteLine("Introduce valor inicial de grados celsius:");

Icelsius = double.Parse(Console.ReadLine());

Console.WriteLine("Introduce valor final de grados celsius:");

Fcelsius = double.Parse(Console.ReadLine());

Console.WriteLine("Introduce incremento:");

INC = double.Parse(Console.ReadLine());

ValorI = Icelsius;

Console.WriteLine("Celsius Fahrenheit");

while(ValorI <= Fcelsius)

{

Fah= (9.0/5.0)*ValorI+32;

Console.WriteLine("{0} {1}",ValorI,Fah);

ValorI= ValorI + INC;

}

Console.ReadKey();

}

}

}


No hay comentarios:

Publicar un comentario