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 WinFormsApp1
{
public partial class Form2 : Form
{
string option;
decimal num1;
decimal num2;
decimal result;
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
option = "+";
num1 = decimal.Parse(textbox.Text);
textbox.Clear();
}
private void button2_Click(object sender, EventArgs e)
{
option = "-";
num1 = decimal.Parse(textbox.Text);
textbox.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
option = "*";
num1 = decimal.Parse(textbox.Text);
textbox.Clear();
}
private void button4_Click(object sender, EventArgs e)
{
option = "/";
num1 = decimal.Parse(textbox.Text);
textbox.Clear();
}
private void button14_Click(object sender, EventArgs e)
{
num2 = decimal.Parse(textbox.Text);
if (option == ("+"))
result = num1 + num2;
if (option == ("-"))
result = num1 - num2;
if (option == ("*"))
result = num1 * num2;
if (option == ("/"))
result = num1 / num2;
textbox.Text = result + "";
}
private void button16_Click(object sender, EventArgs e)
{
textbox.Text = textbox.Text + "0";
}
private void button7_Click(object sender, EventArgs e)
{
textbox.Text = textbox.Text + "1";
}
private void button6_Click(object sender, EventArgs e)
{
textbox.Text = textbox.Text + "2";
}
private void button5_Click(object sender, EventArgs e)
{
textbox.Text = textbox.Text + "3";
}
private void button10_Click(object sender, EventArgs e)
{
textbox.Text = textbox.Text + "4";
}
private void button9_Click(object sender, EventArgs e)
{
textbox.Text = textbox.Text + "5";
}
private void button8_Click(object sender, EventArgs e)
{
textbox.Text = textbox.Text + "6";
}
private void button13_Click(object sender, EventArgs e)
{
textbox.Text = textbox.Text + "7";
}
private void button12_Click(object sender, EventArgs e)
{
textbox.Text = textbox.Text + "8";
}
private void button11_Click(object sender, EventArgs e)
{
textbox.Text = textbox.Text + "9";
}
private void button17_Click(object sender, EventArgs e)
{
if (!textbox.Text.Contains("."))
{
textbox.Text += ".";
}
button12.Enabled = !string.IsNullOrEmpty(textbox.Text);
}
private void button15_Click(object sender, EventArgs e)
{
textbox.Clear();
option = "";
result = 0;
button15.Enabled = true;
}
private void button18_Click(object sender, EventArgs e)
{
textbox.Clear();
option = "";
result = 0;
num1 = 0;
num2 = 0;
button18.Enabled = true;
}
private void button19_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}