0 0 1 1 1 3
0 1 1 0 0 0
0 0 0 0 0 0
1.0
0.5
#include<iostream> #include<cstdio> #include<math.h> using namespace std; int main() { int x1,y1,x2,y2,x3,y3; double a,b,c; double area,p; while(1) { cin>>x1>>y1>>x2>>y2>>x3>>y3; if(x1||y1||x2||y2||x3||y3) { a = sqrt(pow((x1 - x2),2)+ pow((y1 - y2),2)); b = sqrt(pow((x1 - x3),2)+ pow((y1 - y3),2)); c = sqrt(pow((x2 - x3),2)+ pow((y2 - y3),2)); p=(a+b+c)/2.0; area=sqrt(p*(p-a)*(p-b)*(p-c)); printf("%.1lf\n",area); } else break; } }
原文:http://www.cnblogs.com/tt-t/p/5059734.html