Beispiel #1
0
    protected void OnBigualClicked(object sender, EventArgs e)
    {
        if (igual == 0)
        {
            String display = Entrada.Text.ToString();
            numero2 = float.Parse(display);
            Entrada.DeleteText(0, Entrada.Text.Length);
            igual++;
            switch (operando)
            {
            case '/':
                Total = numero1 / numero2;
                break;

            case '*':
                Total = numero1 * numero2;
                break;

            case '-':
                Total = numero1 - numero2;
                break;

            case '+':
                Total = numero1 + numero2;
                break;
            }

            Entrada.InsertText(Total.ToString());
        }
    }
Beispiel #2
0
 protected void OnBborrarClicked(object sender, EventArgs e)
 {
     if (igual == 0)
     {
         Entrada.DeleteText(Entrada.Text.Length - 1, Entrada.Text.Length);
     }
 }
Beispiel #3
0
 protected void OnB8Clicked(object sender, EventArgs e)
 {
     if (igual == 0)
     {
         String display = Entrada.Text.ToString();
         Entrada.DeleteText(0, Entrada.Text.Length);
         Entrada.InsertText(display + "8");
     }
 }
Beispiel #4
0
 protected void OnBvaciarClicked(object sender, EventArgs e)
 {
     Entrada.DeleteText(0, Entrada.Text.Length);
     operando = ' ';
     numero1  = 0;
     numero2  = 0;
     Total    = 0;
     igual    = 0;
     punto    = 0;
 }
Beispiel #5
0
 protected void OnBsumaClicked(object sender, EventArgs e)
 {
     if (igual == 0)
     {
         operando = '+';
         String display = Entrada.Text.ToString();
         numero1 = float.Parse(display);
         Entrada.DeleteText(0, Entrada.Text.Length);
         punto--;
     }
 }
Beispiel #6
0
 protected void OnBpuntoClicked(object sender, EventArgs e)
 {
     if (igual == 0)
     {
         if (Entrada.Text.ToString() == "")
         {
             punto++;
             String display = Entrada.Text.ToString();
             Entrada.DeleteText(0, Entrada.Text.Length);
             Entrada.InsertText(display + "0,");
         }
         if (punto == 0)
         {
             punto++;
             String display = Entrada.Text.ToString();
             Entrada.DeleteText(0, Entrada.Text.Length);
             Entrada.InsertText(display + ",");
         }
     }
 }