Beruflich Dokumente
Kultur Dokumente
using System.Collections.Generic;
using System.Windows.Forms;
namespace WindowsApplication5
{
static class Program
{
/// <summary>
/// Punto de entrada principal para la aplicación.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
public class operaciones
{
double operando1;
double operando2;
double resultado;
public void SetSuma(double operando1, double operando2)
{
this.operando1 = operando1;
this.operando2 = operando2;
resultado = operando1 + operando2;
}
public void SetResta(double operando1, double operando2)
{
this.operando1 = operando1;
this.operando2 = operando2;
resultado = operando1 - operando2;
}
public void SetMulti(double operando1, double operando2)
{
this.operando1 = operando1;
this.operando2 = operando2;
resultado = operando1 * operando2;
}
public void SetDivi(double operando1, double operando2)
{
this.operando1 = operando1;
this.operando2 = operando2;
resultado = operando1 / operando2;
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication5
{
public partial class Form1 : Form
{
double valor1;
double valor2;
double resultado;
Boolean primo;
operaciones operacion = new operaciones();
calcularoperaporc = new calcular ();
calculo calcPriFac = new calculo();
public Form1()
{
InitializeComponent();
}
valor1 = Convert.ToDouble(txt_Valor1.Text);
calcPriFac.SetPrimo(valor1);
primo = calcPriFac.GetResultadoPrimo();
if (primo == false)
{
txt_Resultado.Text = "El Numero no es primo";
}
else
{
txt_Resultado.Text = "El Numero es primo";
}
}
else
{
txt_Resultado.Text = "El numero no puede calcularse si es
primo";
}
}
}