Form1.cs 2.3 KB

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