Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. if (checkBox1.Checked)
  2. {
  3. int s1 = Convert.ToInt32(textBox1.Text);
  4. int s2 = Convert.ToInt32(textBox2.Text);
  5. int s3 = Convert.ToInt32(textBox5.Text);
  6. delta = s2 * s2 - 4 * s1 * s3;
  7. if (delta > 0)
  8. {
  9. x1 = ((-s2) + Math.Sqrt(delta)) / (2.0 * s1);
  10. x1 = ((-s2) - Math.Sqrt(delta)) / (2.0 * s1);
  11. }
  12. if (delta == 0)
  13. {
  14. x1 = -s2 / (2.0 * s1);
  15. x2 = -s2 / (2.0 * s1);
  16. }
  17. if (delta <0)
  18. {
  19. x1 = -s2 / (2.0 * s1);
  20. x2 = Math.Sqrt(-delta) / (2.0 * s1);
  21. }
  22. textBox6.Text = "x1= " + Convert.ToString(x1) + "; x2= " + Convert.ToString(x2);
  23. }
  24. if(checkBox2.Checked)
  25. {
  26. string functie = listBox1.Text;
  27. if (functie == "sin(x)")
  28. rezultat = Math.Asin(Convert.ToDouble(textBox7.Text));
  29. if (functie == "cos(x)")
  30. rezultat = Math.Acos(Convert.ToDouble(textBox7.Text));
  31. if (functie == "tg(x)")
  32. rezultat = Math.Atan(Convert.ToDouble(textBox7.Text));
  33. if (functie == "ctg(x)")
  34. rezultat = 1/Math.Atan(Convert.ToDouble(textBox7.Text));
  35. textBox6.Text = rezultat.ToString();
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement