domingo, 13 de septiembre de 2009

PRACTICA 2.1 MILLAS

CONSOLA



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace practica_2._2_console
{
class Program
{
static void Main(string[] args)
{
int distancia, vel, tiempo;
Console.WriteLine("\n\t\tPrograma que calcula la distancia en millas");
Console.WriteLine("\n\nIntroduce el valor entero que representa la velocidad del viaje:");
vel = int.Parse(Console.ReadLine());
Console.WriteLine("\nIntroducee el valor entero que representa el tiempo transcurrido:");
tiempo = int.Parse(Console.ReadLine());
distancia = vel * tiempo;
Console.WriteLine("\nLa distancia total en millas es: {0}", distancia);
Console.ReadLine();
}
}
}



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_2._3
{
public partial class Form1 : Form
{
int v, t, d;
public Form1()
{
v = t = d = 0;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
v = int.Parse(txtb1.Text);
t = int.Parse(txtb2.Text);
d = v * t;
txtb3.Text = d.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
txtb1.Clear();
txtb2.Clear();
txtb3.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
private void txtb1_TextChanged(object sender, EventArgs e)
{
}
}
}
















No hay comentarios:

Publicar un comentario