Advertisement
fursty

TSP ne raboti math

Oct 15th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  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.  
  11. namespace WindowsFormsApplication2
  12. {
  13. public partial class Form2 : Form
  14. {
  15. public Form2()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. void calc()
  21. {
  22. double a, b, c;
  23. a = double.Parse(textBox1.Text);
  24. b = double.Parse(textBox2.Text);
  25. c = double.Parse(textBox3.Text);
  26. if (radioButton1.Checked)
  27. {
  28. c = Math.Pow(a, 2) + Math.Pow(b, 2);
  29. }
  30.  
  31. if (radioButton2.Checked)
  32. {
  33. c = Math.Pow(a, 2) - Math.Pow(b, 2);
  34. }
  35.  
  36.  
  37. }
  38.  
  39. private void Form2_Load(object sender, EventArgs e)
  40. {
  41.  
  42. }
  43.  
  44. private void textBox1_TextChanged(object sender, EventArgs e)
  45. {
  46. calc();
  47. }
  48.  
  49. private void textBox2_TextChanged(object sender, EventArgs e)
  50. {
  51. calc();
  52. }
  53.  
  54. private void textBox3_TextChanged(object sender, EventArgs e)
  55. {
  56. calc();
  57. }
  58.  
  59. private void radioButton1_CheckedChanged(object sender, EventArgs e)
  60. {
  61. calc();
  62. }
  63.  
  64. private void radioButton2_CheckedChanged(object sender, EventArgs e)
  65. {
  66. calc();
  67. }
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement