domingo, 7 de diciembre de 2008

practica 4

Problema 1 en console

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

namespace practica_4_trabajo_1
{
class Program
{
static void Main(string[] args)
{
double peso, dolar, contD;
Console.WriteLine("Escriba el tipo de cambio");
dolar = double.Parse(Console.ReadLine());
Console.WriteLine("\ncantidad de pesos: ");
peso = double.Parse(Console.ReadLine());
contD = peso / dolar;
Console.WriteLine("\ncantida en dolares: "+contD);
Console.ReadLine();

}
}
}



Problema 1 en 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_4_problema_1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double pesos, dolar, cantD;
pesos = double.Parse(textBox2.Text);
dolar = double.Parse(textBox1.Text);
cantD = pesos / dolar;
textBox3.Text = cantD.ToString();

}
}
}




Problema 2 en console

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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double C, F;
Console.WriteLine("introdusca el valor de grados Centigrados");
Console.Write("C= ");
C = double.Parse(Console.ReadLine());
F = (9.0 / 5.0) * C + 32.0;
Console.WriteLine("\nla conversion a grados Fahrenheit es: " + F);
Console.ReadLine();
}
}
}



Problema 2 en 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_4_promblema_2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double C, F;
C = double.Parse(textBox1.Text);
F = (9.0 / 5.0) * C + 32.0;
textBox2.Text = F.ToString();
}
}
}





Problema 3 en consola

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

namespace practica_4_trabajo_3_console
{
class Program
{
static void Main(string[] args)
{
double pies, yardas, pulgadas, centimetros, metros;
Console.WriteLine("ingresar cantidad de pies a convertir:");
pies = int.Parse(Console.ReadLine());
yardas = pies / 3;
Console.WriteLine("\nEquivale a " + yardas+" yardas");
pulgadas = pies * 12;
Console.WriteLine("\nEquivale a " + pulgadas + " pulgadas");
centimetros = pies * 30.48;
Console.WriteLine("\nEquivale a "+centimetros+" centimetros");
metros=0.3048*pies;
Console.WriteLine("\nEquivale a " + metros + " metros");
Console.ReadLine();


}
}
}




Problema 3 en windows

System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace practica_4_trabajo_3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{

double pies, yardas, pulgadas, centimetros, metros;
pies = double.Parse(textBox1.Text);
yardas = pies / 3;
textBox2.Text = yardas.ToString();
pulgadas = pies * 12;
textBox3.Text = pulgadas.ToString();
centimetros = pies * 30.48;
textBox4.Text = centimetros.ToString();
metros = pies * 0.3048;
textBox5.Text = metros.ToString();



}

}

}


No hay comentarios: