<summary>
</summary>
struct Point
{
public double x;
public double y;
public override string ToString()
{
return "(" + x + ", " + y + ")";
}
}
<summary>
</summary>
struct Triangle{
public Point a;
public Point b;
public Point c;
<summary>
</summary>
<returns></returns>
public double GetArea()
{
double abx, aby, acx, acy;
abx = b.x - a.x;
aby = b.y - a.y;
acx = c.x - a.x;
acy = c.y - a.y;
return Math.Abs(abx * acy - aby * acx) / 2;
}
}
static void Main(string[] args)
{
Triangle t;
t.a.x = 5;
t.a.y = 3;
t.b.x = 4;
t.b.y = 6;
t.c.x = 7;
t.c.y = 9;
Console.WriteLine("三角形の面積は{0}", t.GetArea());
}