Form1.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 KhramovaKalkylyator
  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. }