class Program
{
public class Tochka
{
public double x, y;
// два конструктора
public Tochka() { }
public Tochka(double x, double y)
{
this.x = x;
this.y = y;
}
}
static double Distance(Tochka p1, Tochka p2)
{
return Math.Sqrt(Math.Pow(p2.x - p1.x, 2) +
Math.Pow(p2.y - p1.y, 2));
}
static double Surface(Tochka p1, Tochka p2,
Tochka p3)
{
double a = Distance(p1, p2);
double b = Distance(p2, p3);
double c = Distance(p1, p3);
double p = (a + b + c) / 2;
return Math.Sqrt(p * (p - a) * (p - b) * (p - c));
}
static void Main(string[] args)
{
Tochka p1 = new Tochka();
Console.Write("p1.x = ");
p1.x = Convert.ToDouble(Console.ReadLine());
Console.Write("p1.y = ");
p1.y = Convert.ToDouble(Console.ReadLine());
Tochka p2 = new Tochka();
Console.Write("p2.x = ");
p2.x = Convert.ToDouble(Console.ReadLine());
Console.Write("p2.y = ");
p2.y = Convert.ToDouble(Console.ReadLine());
Tochka p3 = new Tochka();
Console.Write("p3.x = ");
p3.x = Convert.ToDouble(Console.ReadLine());
Console.Write("p3.y = ");
p3.y = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("S = {0}", Surface(p1, p2, p3));
Console.ReadKey();
}
}