Калькулятор1_Ледовских.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 Калькулятор_Ледовских
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18. public static double sum(double a, double b)
  19. {
  20. return a + b;
  21. }
  22. public static double razn(double a, double b)
  23. {
  24. return a - b;
  25. }
  26. public static double umnog(double a, double b)
  27. {
  28. return a * b;
  29. }
  30. public static double del(double a, double b)
  31. {
  32. return a / b;
  33. }
  34. public static double step(double a, double b)
  35. {
  36. return Math.Pow(a, b);
  37. }
  38. public static double koren(double a, double b)
  39. {
  40. return Math.Pow(a, 1 / b);
  41. }
  42. private void button1_Click(object sender, EventArgs e)
  43. {
  44. textBox3.Text = Convert.ToString(sum(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text)));
  45. }
  46. private void button2_Click(object sender, EventArgs e)
  47. {
  48. textBox3.Text = Convert.ToString(razn(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text)));
  49. }
  50. private void button3_Click(object sender, EventArgs e)
  51. {
  52. textBox3.Text = Convert.ToString(umnog(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text)));
  53. }
  54. private void button4_Click(object sender, EventArgs e)
  55. {
  56. textBox3.Text = Convert.ToString(del(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text)));
  57. }
  58. private void button5_Click(object sender, EventArgs e)
  59. {
  60. textBox3.Text = Convert.ToString(step(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text)));
  61. }
  62. private void button6_Click(object sender, EventArgs e)
  63. {
  64. textBox3.Text = Convert.ToString(koren(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text)));
  65. }
  66. }
  67. }