using System;
using System.Collections.Generic;using System.Text;
namespace Practica_4_Consola
{
class Program
{
static void Main(string[] args)
{
int Dist, Vel, Tiem;
Console.WriteLine("Programa que calcula la distancia en millas");
Console.WriteLine("Realizado por Ing. Ruiz Morales S.");
Console.WriteLine("Introduce valor entero que represente la Velocidad de viaje");
Vel = int.Parse(Console.ReadLine());
Console.WriteLine("Introduce valor entero que represente el tiempo transcurrido");
Tiem = int.Parse(Console.ReadLine());
Dist = Vel * Tiem;
Console.WriteLine("La distancia total es {0} millas", Dist);
Console.ReadKey(); } }}
Windows.
using System;
using System.Collections.Generic;using System.ComponentModel;
using System.Data;using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Practica_4_Windows
{
public partial class Form1 : Form
{
int Dist, Vel, Tiem;
public Form1()
{
InitializeComponent();
Dist = Vel = Tiem = 0;
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void CALCULAR_Click(object sender, EventArgs e)
{
Vel = int.Parse(textBox1.Text);
Tiem = int.Parse(textBox2.Text);
Dist = Vel * Tiem;
textBox3.Text = Dist.ToString();
}
private void CLEAR_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox1.Focus();
}
private void SALIR_Click(object sender, EventArgs e)
{
Close(); } }}
No hay comentarios:
Publicar un comentario