Form1.cs 2.3 KB

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