1

But draw the triangle (0,0)(1,0)(2,0)! Ofcourse the area is 0, because we have three points in one line.

Use (0,0), (2,3) and (4,1) to check.

Votes + Comments
Very helpful!
0

OH MAN HAHA ! You're the greatest hiddepolen :D

Thanks for everything and putting up with my nonsense.

Solved!

0

Glad that hiddpolen helped you solve your problem.

Anyway, one comment on the condition.

return !(a+b<c || b+c<a || a+c<b || a == 0 || b == 0 || c == 0);

This is actually the same as what I suggested earlier (add the = sign).

return !(a+b<=c || b+c<=a || a+c<=b);

The reason is whenever a side of 3 points is 0, other 2 sides will always be the same regardless. I am not saying that doing the before is wrong. It is just a way of thinking when you do programming. It just make the code look cleaner and more succinct.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.