Está en la página 1de 14

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace Calculadora_Daniel_Ugarte_Balanza

public partial class Form1 : Form

public double ope1, ope2;

public char operador;

bool nuevo = true;

bool coma = false;

string borrado;

double memoria;

public Form1()

InitializeComponent();

public void ponerNro(string n){

if (nuevo)

pantalla1.Text = n;

nuevo = false;

else
pantalla1.Text = pantalla1.Text + n;

private void label1_Click(object sender, EventArgs e)

private void radioButton2_CheckedChanged(object sender, EventArgs e)

private void button25_Click(object sender, EventArgs e)

private void button22_Click(object sender, EventArgs e)

private void button23_Click(object sender, EventArgs e)

}
private void button21_Click(object sender, EventArgs e)

aux.Text = pantalla1.Text + "10ⁿ";

operador = 'ⁿ';

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

pantalla1.Text = Math.Pow(10, ope1).ToString();

private void button29_Click(object sender, EventArgs e)

ponerNro("1");

private void button28_Click(object sender, EventArgs e)

ponerNro("2");

private void button27_Click(object sender, EventArgs e)

ponerNro("3");

private void button34_Click(object sender, EventArgs e)

ponerNro("4");

private void button33_Click(object sender, EventArgs e)

{
ponerNro("5");

private void button32_Click(object sender, EventArgs e)

ponerNro("6");

private void button39_Click(object sender, EventArgs e)

ponerNro("7");

private void button38_Click(object sender, EventArgs e)

ponerNro("8");

private void button37_Click(object sender, EventArgs e)

ponerNro("9");

private void button54_Click(object sender, EventArgs e)

aux.Text = pantalla1.Text + "+";

operador = '+';

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

}
private void button26_Click(object sender, EventArgs e)

ope2 = double.Parse(pantalla1.Text);

switch (operador)

case '+':

aux.Text = "";

pantalla1.Text = (ope1 + ope2).ToString();

break;

case '-':

aux.Text = "";

pantalla1.Text= (ope1 - ope2).ToString();

break;

case '*':

aux.Text = "";

pantalla1.Text = (ope1 * ope2).ToString();

break;

case '/':

aux.Text = "";

pantalla1.Text = (ope1 / ope2).ToString();

break;

case '√':
{

aux.Text = "";

pantalla1.Text = (Math.Sqrt(ope2)).ToString();

break;

case '^':

aux.Text = "";

pantalla1.Text = Math.Pow(ope1, ope2).ToString();

break;

case '%':

aux.Text = "";

pantalla1.Text = ((ope2 / 100) * ope1).ToString();

break;

private void button30_Click(object sender, EventArgs e)

aux.Text = pantalla1.Text + "-";

operador = '-';

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

private void button35_Click(object sender, EventArgs e)


{

aux.Text = pantalla1.Text + "*";

operador = '*';

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

private void button40_Click(object sender, EventArgs e)

aux.Text = pantalla1.Text + "/";

operador = '/';

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

private void button41_Click(object sender, EventArgs e)

aux.Text = pantalla1.Text + "√";

operador = '√';

ope1 = double.Parse(pantalla1.Text);

pantalla1.Text = Math.Sqrt(ope1).ToString();

nuevo = true;

private void button52_Click(object sender, EventArgs e)

ponerNro("0");

private void button2_Click(object sender, EventArgs e)

{
aux.Text = pantalla1.Text + "(";

operador = '(';

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

private void button5_Click(object sender, EventArgs e)

aux.Text = pantalla1.Text + ")";

operador = ')';

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

private void button51_Click(object sender, EventArgs e)

if (!coma)

pantalla1.Text = pantalla1.Text + ",";

coma = false;

private void button49_Click(object sender, EventArgs e)

private void button42_Click(object sender, EventArgs e)

pantalla1.Text = "0";
ope1 = 0;

ope2 = 0;

nuevo = true;

aux.Text = "";

nuevo = true;

private void salirToolStripMenuItem_Click(object sender, EventArgs e)

DialogResult res;

res = MessageBox.Show("Quiere salir??", "Ventana de confimacion",


MessageBoxButtons.OKCancel,MessageBoxIcon.Stop);

if (res==DialogResult.OK)

this.Close();

private void button44_Click(object sender, EventArgs e)

int x=0;

borrado = pantalla1.Text;

x = borrado.Length - 1;

borrado=borrado.Substring(0,x);

pantalla1.Text = borrado;

if (pantalla1.Text=="")

pantalla1.Text = "0";

nuevo = true;

if (pantalla1.Text == "-")

pantalla1.Text = "0";
nuevo = true;

private void button45_Click(object sender, EventArgs e)

aux.Text = pantalla1.Text + "±";

operador = '±';

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

pantalla1.Text = Math.Pow(ope1, -1).ToString();

private void bsinh_Click(object sender, EventArgs e)

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

pantalla1.Text = Math.Sinh(ope1).ToString();

private void bsin_Click(object sender, EventArgs e)

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

pantalla1.Text = Math.Sin(ope1).ToString();

private void bpi_Click(object sender, EventArgs e)

ope1 = double.Parse(pantalla1.Text);

nuevo = true;
pantalla1.Text = Math.PI.ToString();

private void button20_Click(object sender, EventArgs e)

aux.Text = pantalla1.Text + "x³";

double cubo;

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

cubo = ope1 * ope1 * ope1;

pantalla1.Text = "" + cubo;

private void button10_Click(object sender, EventArgs e)

aux.Text = pantalla1.Text + "x²";

double cuad;

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

cuad = ope1 * ope1;

pantalla1.Text = "" + cuad;

private void button15_Click(object sender, EventArgs e)

aux.Text = pantalla1.Text + "^";

operador = '^';

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

pantalla1.Text = "" + ope1;


}

private void button36_Click(object sender, EventArgs e)

operador ='%';

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

pantalla1.Text = "" + ope1;

private void bMS_Click(object sender, EventArgs e)

private void acercaDeLaCalculadoraToolStripMenuItem_Click(object sender, EventArgs e)

Form nuevo;

Acerca frm = new Acerca();

frm.Show();

private void bcosh_Click(object sender, EventArgs e)

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

pantalla1.Text = Math.Cosh(ope1).ToString();

private void btanh_Click(object sender, EventArgs e)


{

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

pantalla1.Text = Math.Tanh(ope1).ToString();

private void bcos_Click(object sender, EventArgs e)

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

pantalla1.Text = Math.Cos(ope1).ToString();

private void btan_Click(object sender, EventArgs e)

ope1 = double.Parse(pantalla1.Text);

nuevo = true;

pantalla1.Text = Math.Tan(ope1).ToString();

private void button43_Click(object sender, EventArgs e)

private void button50_Click(object sender, EventArgs e)

private void button24_Click(object sender, EventArgs e)


{

También podría gustarte