You are on page 1of 1

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace bai2
{
class Program
{
static void Main(string[] args)
{
Diem A = new Diem(1, 2);
Diem B = new Diem(3, 4);
Console.WriteLine("Diem A({0},{1})", A.hoanhdo, A.tungdo);
Console.WriteLine("Diem B({0},{1}", B.hoanhdo, B.tungdo);
Console.WriteLine("khoang cach gia AB la {0}", A.kcd(B));
Console.ReadLine();
}

}
public class Diem
{
public double hoanhdo;
public double tungdo;
public Diem()
{
hoanhdo = 0;
tungdo = 0;
}
public Diem( double HD, double TD)
{
HD = hoanhdo;
TD = tungdo;
}
public Diem(Diem A)
{
hoanhdo = A.hoanhdo;
tungdo = A.tungdo;
}
public double kcd(Diem B)
{
double kc= Math.Sqrt(Math.Pow((hoanhdo - B.hoanhdo), 2) +
Math.Pow((tungdo - B.tungdo), 2));
return kc;
}

}
}

You might also like