lunes, 12 de octubre de 2009

PRACTICA 5.1

FLUJO
CONSOLA

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

namespace practica_5._1_consola
{
class Program
{
static void Main(string[] args)
{
double celsius , INC,Fah;
int N,Contador=1;
Console.WriteLine("Valor Inicial Grados Celsius");
celsius = double.Parse(Console.ReadLine());
Console.WriteLine("Numero de Conversiones");
N = int.Parse(Console.ReadLine());
Console.WriteLine("Incremetos");
INC = double.Parse(Console.ReadLine());
Console.WriteLine("Celsius Fahrenheit");
while (Contador <= N) { Fah = (9.0 / 5.0) * celsius + 32; Console.WriteLine("{0} {1}", celsius, Fah); celsius = celsius + INC; Contador = Contador + 1; { } } Console.ReadKey(); } } }

windows





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_windows
{
public partial class Form1 : Form
{
double cel, inc, fah;
int n, cont = 1;
public Form1()
{
n=cont = 1;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double cel, inc, fah;
int n, cont = 1;
cel = double.Parse(textBox1.Text);
n = int.Parse(textBox2.Text);
inc = double.Parse(textBox3.Text);
listBox1.Items.Add("celsius \t\tfahreheint");
while (cont <= n)
{
fah = (9.0 / 5.0) * cel + 32;
listBox1.Items.Add(cel.ToString() + "\t\t" + fah.ToString());
cel = cel + inc;
cont = cont + 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 listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}

No hay comentarios:

Publicar un comentario