jueves, 17 de septiembre de 2009

Practica 3

Consola
using System;
using System.Collections.Generic;
using System.Text;
namespace Practica_3_Console
{
class Program
{
static void Main(string[] args)
{
int N, M, P, RS;
Console.WriteLine("Introduce la cantidad de Resistencias de 56 Ohms");
N = int.Parse(Console.ReadLine());
Console.WriteLine("Introduce la cantidad de Resistencias de 330 Ohms");
M = int.Parse(Console.ReadLine());
Console.WriteLine("Introduce la cantidad de Resistencias de 15 Ohms");
P = int.Parse(Console.ReadLine());
RS = N * 56 + M * 33 + P * 15;
Console.WriteLine("\n\tLa Resistencia total en Serie es {0}\t\t", RS);
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_3_Wwindows
{
public partial class Form1 : Form
{
int N, M, P, RS;
public Form1()
{
InitializeComponent();
N = M = P = RS = 0;
}
private void button1_Click(object sender, EventArgs e)
{
N = int.Parse(textBox1.Text);
M = int.Parse(textBox2.Text);
P = int.Parse(textBox3.Text);
RS = N * 56 + M * 33 + P * 15;
textBox4.Text = RS.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox1.Focus();
}
private void button3_Click(object sender, EventArgs e)
{
Close(); } }}





No hay comentarios: