jueves, 12 de noviembre de 2009

Practica 10.2 Visual


PSEUDOCODIGO
REAL[] resistencia ={16,27,39,56,81};
REAL[] corriente = new int [5];
REAL[] potencia = new int[5];
REAL total = 0, I = 0;
for (I = 0 TO 4 STEP I=I+1)
{
PRINT("Introduce corriente",I);
READ corriente[I]
potencia[I] = resistencia[I] * (corriente[I] * corriente[I]);
total = total + potencia[I];

}

PRINT(" Resistencia Corriente Potencia");
PRINT("________________________________________________");

for (I = 0 TO 4 STEP I=I+1)
{
PRINT(" {0} {1} {2}", resistencia[I], corriente[I], potencia[I]);

}
PRINT("Total= " + total);
FINAL









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_10_1_W
{
public partial class Form1 : Form
{
int[] RESISTENCIAS = { 16, 27, 39, 56, 81 };
int[] CORRIENTE = new int[5];
int[] POTENCIA = new int[5];
int TOTAL = 0;
int I;

public Form1()
{
InitializeComponent();
listBox1.Items.Add("Resistencia Corriente Potencia");
listBox1.Items.Add("_____________________________________________");

}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show("El total es:" + TOTAL);

{



}
}

private void button1_Click(object sender, EventArgs e)
{
if (I <>
{
textBox1.Focus();
CORRIENTE[I] = int.Parse(textBox1.Text);
POTENCIA[I] = CORRIENTE[I] * RESISTENCIAS[I];
textBox1.Clear();
POTENCIA[I] = RESISTENCIAS[I] * CORRIENTE[I] * CORRIENTE[I];
TOTAL = TOTAL + POTENCIA[I];
listBox1.Items.Add(RESISTENCIAS[I] + "\t\t" + CORRIENTE[I] + "\t\t" + POTENCIA[I]);
I++;
}

}

private void button3_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
textBox1.Clear();

}

private void button4_Click(object sender, EventArgs e)
{
Close();
}
}
}

No hay comentarios:

Publicar un comentario