Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace SoftuniSv
- {
- class Program
- {
- static double Distance(Point p1, Point p2)
- {
- double d = Math.Sqrt((p1.x - p2.x)* (p1.x - p2.x) + (p1.y - p2.y)* (p1.y - p2.y));
- return d;
- }
- static void Main(string[] args)
- {
- Point p1 = new Point();
- p1.x = 5;
- p1.y = 6.2;
- p1.name = "A";
- p1.Print();
- Point p2 = new Point();
- p2.x = 5;
- p2.y = 6.2;
- p2.name = "B";
- p2.Print();
- double dist = Distance(p1, p2);
- Console.WriteLine($"A <-> B: {dist}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement