Form1.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. namespace Calc2
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18. float a, b;
  19. int oper;
  20. bool znak = true;
  21. private void button15_Click(object sender, EventArgs e)
  22. {
  23. if (znak == true)
  24. {
  25. textBox1.Text = "-" + textBox1.Text;
  26. znak = false;
  27. }
  28. else if (znak == false)
  29. {
  30. textBox1.Text = textBox1.Text.Replace("-", "");
  31. znak = true;
  32. }
  33. }
  34. private void button11_Click(object sender, EventArgs e)
  35. {
  36. textBox1.Text = textBox1.Text + 0;
  37. }
  38. private void button12_Click(object sender, EventArgs e)
  39. {
  40. textBox1.Text = textBox1.Text + ",";
  41. }
  42. private void button16_Click(object sender, EventArgs e)
  43. {
  44. a = float.Parse(textBox1.Text);
  45. textBox1.Clear();
  46. oper = 1;
  47. label1.Text = a.ToString() + "+";
  48. znak = true;
  49. }
  50. }
  51. }