document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace SimpeCalculator
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         Double result = 0;
  16.         String operation = "";
  17.         bool isOperationPerformed = false;
  18.         public Form1()
  19.         {
  20.             InitializeComponent();
  21.         }
  22.  
  23.         private void button1_Click(object sender, EventArgs e)
  24.         {
  25.             if ((textBox_resut.Text == "0") || (isOperationPerformed))
  26.                 textBox_resut.Clear();
  27.             isOperationPerformed = false;
  28.             Button button = (Button)sender;
  29.             if (button.Text == ".")
  30.             {
  31.                 if(!textBox_resut.Text.Contains("."))
  32.                     textBox_resut.Text += button.Text;
  33.             }
  34.             else
  35.                 textBox_resut.Text += button.Text;
  36.            
  37.         }
  38.  
  39.         private void Operator_click(object sender, EventArgs e)
  40.         {
  41.             Button button = (Button)sender;
  42.  
  43.             if(result != 0)
  44.             {
  45.                 button5.PerformClick();
  46.                 operation = button.Text;
  47.                 labelCurrentOperation.Text = result + " " + operation;
  48.                 isOperationPerformed = true;
  49.             }
  50.             else
  51.             {
  52.                 operation = button.Text;
  53.                 result = Double.Parse(textBox_resut.Text);
  54.                 labelCurrentOperation.Text = result + " " + operation;
  55.                 isOperationPerformed = true;
  56.             }
  57.         }
  58.  
  59.         private void button16_Click(object sender, EventArgs e)
  60.         {
  61.             textBox_resut.Text = "0";
  62.         }
  63.  
  64.         private void button11_Click(object sender, EventArgs e)
  65.         {
  66.             textBox_resut.Text = "0";
  67.             result = 0;
  68.         }
  69.  
  70.         private void button5_Click(object sender, EventArgs e)
  71.         {
  72.             switch (operation)
  73.             {
  74.                 case "+":
  75.                     textBox_resut.Text = (result + Double.Parse(textBox_resut.Text)).ToString();
  76.                     break;
  77.                 case "-":
  78.                     textBox_resut.Text = (result - Double.Parse(textBox_resut.Text)).ToString();
  79.                     break;
  80.                 case "*":
  81.                     textBox_resut.Text = (result * Double.Parse(textBox_resut.Text)).ToString();
  82.                     break;
  83.                 case "/":
  84.                     textBox_resut.Text = (result / Double.Parse(textBox_resut.Text)).ToString();
  85.                     break;
  86.                 default:
  87.                     break;
  88.             }
  89.             result = Double.Parse(textBox_resut.Text);
  90.             labelCurrentOperation.Text = "";
  91.         }
  92.  
  93.         private void labelCurrentOperation_Click(object sender, EventArgs e)
  94.         {
  95.  
  96.         }
  97.     }
  98. }
  99.  
');