Guest User

Untitled

a guest
Oct 11th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. using System;
  2. namespace Task9LongerLine
  3. {
  4. class Task9LongerLine
  5. {
  6. static void FirstPoint(double a, double b, double c, double d)
  7. {
  8. double Point1 = Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2));
  9. double Point2 = Math.Sqrt(Math.Pow(c, 2) + Math.Pow(d, 2));
  10. if (Point1 == Point2)
  11. {
  12. Console.WriteLine($"({a}, {b})({c}, {d})");
  13. }
  14. if (Point1 > Point2)
  15. {
  16. Console.WriteLine($"({c}, {d})({a}, {b})");
  17. }
  18. if (Point1 < Point2)
  19. {
  20. Console.WriteLine($"({a}, {b})({c}, {d})");
  21. }
  22. }
  23. static double PodoubleDistans(double a, double b, double c, double d)
  24. {
  25. // тук не ти трябват проверки
  26. double disttans = 0;
  27. //if (a==c)
  28. //{
  29. // disttans = Math.Abs(b)+Math.Abs(d);
  30. // }
  31. //if (b==d)
  32. // {
  33. // disttans = Math.Abs(a) + Math.Abs(c);
  34. //}
  35. // else
  36. // {
  37. //формулата не е такава
  38. // double PodoubleDistans1 = Math.Pow(a, 2) + Math.Pow(b, 2);
  39. // double PodoubleDistans2 = Math.Pow(c, 2) + Math.Pow(d, 2);
  40. disttans = Math.Sqrt(Math.Pow((a - c), 2) + Math.Pow((b- d), 2));
  41. // }
  42. return disttans;
  43. }
  44. static void Main()
  45. {
  46. double x1 = double.Parse(Console.ReadLine());
  47. double y1 = double.Parse(Console.ReadLine());
  48. double x2 = double.Parse(Console.ReadLine());
  49. double y2 = double.Parse(Console.ReadLine());
  50. double x3 = double.Parse(Console.ReadLine());
  51. double y3 = double.Parse(Console.ReadLine());
  52. double x4 = double.Parse(Console.ReadLine());
  53. double y4 = double.Parse(Console.ReadLine());
  54. double l1 = PodoubleDistans(x1, y1, x2, y2);
  55. double l2 = PodoubleDistans(x3, y3, x4, y4);
  56. //if (l1==l2)
  57. //{
  58. // FirstPoint(x1, y1, x2, y2);
  59. //}
  60. if (l1>=l2)
  61. {
  62. FirstPoint(x1, y1, x2, y2);
  63. }
  64. if (l1<l2)
  65. {
  66. FirstPoint(x3, y3, x4, y4);
  67. }
  68. }
  69. }
  70. }
Add Comment
Please, Sign In to add comment