bouchnina

calculatrice c sharp

Mar 18th, 2013
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.11 KB | None | 0 0
  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 NewCalc
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.         int x;
  20.         Boolean add,mul,sous,div = false;
  21.  
  22.  
  23.         private void button1_Click(object sender, EventArgs e)
  24.         {
  25.             textBox1.Text = textBox1.Text + button1.Text;
  26.         }
  27.  
  28.         private void button2_Click(object sender, EventArgs e)
  29.         {
  30.             textBox1.Text = textBox1.Text + button2.Text;
  31.  
  32.         }
  33.  
  34.         private void button3_Click(object sender, EventArgs e)
  35.         {
  36.             textBox1.Text = textBox1.Text + button3.Text;
  37.  
  38.         }
  39.  
  40.         private void button4_Click(object sender, EventArgs e)
  41.         {
  42.             textBox1.Text = textBox1.Text + button4.Text;
  43.  
  44.         }
  45.  
  46.         private void button5_Click(object sender, EventArgs e)
  47.         {
  48.             textBox1.Text = textBox1.Text + button5.Text;
  49.  
  50.         }
  51.  
  52.         private void button6_Click(object sender, EventArgs e)
  53.         {
  54.             textBox1.Text = textBox1.Text + button6.Text;
  55.  
  56.         }
  57.  
  58.         private void button7_Click(object sender, EventArgs e)
  59.         {
  60.             textBox1.Text = textBox1.Text + button7.Text;
  61.  
  62.         }
  63.  
  64.         private void button8_Click(object sender, EventArgs e)
  65.         {
  66.             textBox1.Text = textBox1.Text + button8.Text;
  67.  
  68.         }
  69.  
  70.         private void button9_Click(object sender, EventArgs e)
  71.         {
  72.             textBox1.Text = textBox1.Text + button9.Text;
  73.  
  74.         }
  75.  
  76.         private void button10_Click(object sender, EventArgs e)
  77.         {
  78.             textBox1.Text = textBox1.Text + button10.Text;
  79.  
  80.         }
  81.  
  82.         private void button12_Click(object sender, EventArgs e)
  83.         {
  84.             x = int.Parse(textBox1.Text);
  85.             textBox1.Clear();
  86.             add = true;
  87.    
  88.  
  89.         }
  90.  
  91.         private void button13_Click(object sender, EventArgs e)
  92.         {
  93.             x = int.Parse(textBox1.Text);
  94.             textBox1.Clear();
  95.             sous = true;
  96.         }
  97.  
  98.         private void button14_Click(object sender, EventArgs e)
  99.         {
  100.             x = int.Parse(textBox1.Text);
  101.             textBox1.Clear();
  102.             mul = true;
  103.         }
  104.  
  105.         private void button15_Click(object sender, EventArgs e)
  106.         {
  107.             x = int.Parse(textBox1.Text);
  108.             textBox1.Clear();
  109.             div = true;
  110.         }
  111.  
  112.         private void button11_Click(object sender, EventArgs e)
  113.         {
  114.             if (add) { textBox1.Text = (int.Parse(textBox1.Text) + x).ToString(); add = false; }
  115.             if (mul) { textBox1.Text = (int.Parse(textBox1.Text) * x).ToString(); mul = false; }
  116.             if (div) { textBox1.Text = (int.Parse(textBox1.Text) / x).ToString(); div = false; }
  117.             if (sous) { textBox1.Text = (int.Parse(textBox1.Text) - x).ToString(); sous = false; }
  118.         }
  119.     }
  120. }
Advertisement
Add Comment
Please, Sign In to add comment