Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 NewCalc
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- int x;
- Boolean add,mul,sous,div = false;
- private void button1_Click(object sender, EventArgs e)
- {
- textBox1.Text = textBox1.Text + button1.Text;
- }
- private void button2_Click(object sender, EventArgs e)
- {
- textBox1.Text = textBox1.Text + button2.Text;
- }
- private void button3_Click(object sender, EventArgs e)
- {
- textBox1.Text = textBox1.Text + button3.Text;
- }
- private void button4_Click(object sender, EventArgs e)
- {
- textBox1.Text = textBox1.Text + button4.Text;
- }
- private void button5_Click(object sender, EventArgs e)
- {
- textBox1.Text = textBox1.Text + button5.Text;
- }
- private void button6_Click(object sender, EventArgs e)
- {
- textBox1.Text = textBox1.Text + button6.Text;
- }
- private void button7_Click(object sender, EventArgs e)
- {
- textBox1.Text = textBox1.Text + button7.Text;
- }
- private void button8_Click(object sender, EventArgs e)
- {
- textBox1.Text = textBox1.Text + button8.Text;
- }
- private void button9_Click(object sender, EventArgs e)
- {
- textBox1.Text = textBox1.Text + button9.Text;
- }
- private void button10_Click(object sender, EventArgs e)
- {
- textBox1.Text = textBox1.Text + button10.Text;
- }
- private void button12_Click(object sender, EventArgs e)
- {
- x = int.Parse(textBox1.Text);
- textBox1.Clear();
- add = true;
- }
- private void button13_Click(object sender, EventArgs e)
- {
- x = int.Parse(textBox1.Text);
- textBox1.Clear();
- sous = true;
- }
- private void button14_Click(object sender, EventArgs e)
- {
- x = int.Parse(textBox1.Text);
- textBox1.Clear();
- mul = true;
- }
- private void button15_Click(object sender, EventArgs e)
- {
- x = int.Parse(textBox1.Text);
- textBox1.Clear();
- div = true;
- }
- private void button11_Click(object sender, EventArgs e)
- {
- if (add) { textBox1.Text = (int.Parse(textBox1.Text) + x).ToString(); add = false; }
- if (mul) { textBox1.Text = (int.Parse(textBox1.Text) * x).ToString(); mul = false; }
- if (div) { textBox1.Text = (int.Parse(textBox1.Text) / x).ToString(); div = false; }
- if (sous) { textBox1.Text = (int.Parse(textBox1.Text) - x).ToString(); sous = false; }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment