Advertisement
vencinachev

PointMain

Feb 2nd, 2021
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. using System;
  2.  
  3. namespace SoftuniSv
  4. {
  5. class Program
  6. {
  7. static double Distance(Point p1, Point p2)
  8. {
  9. double d = Math.Sqrt((p1.x - p2.x)* (p1.x - p2.x) + (p1.y - p2.y)* (p1.y - p2.y));
  10. return d;
  11. }
  12. static void Main(string[] args)
  13. {
  14. Point p1 = new Point();
  15. p1.x = 5;
  16. p1.y = 6.2;
  17. p1.name = "A";
  18. p1.Print();
  19.  
  20. Point p2 = new Point();
  21. p2.x = 5;
  22. p2.y = 6.2;
  23. p2.name = "B";
  24. p2.Print();
  25. double dist = Distance(p1, p2);
  26. Console.WriteLine($"A <-> B: {dist}");
  27. }
  28. }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement