lab1.cpp
1 #include "Point.hh" 2 #include <iostream> 3 #include <cmath> 4 5 using namespace std; 6 7 double computeArea(Point &a, Point &b, Point &c) 8 { 9 double x=a.distanceTo(b); 10 double y=b.distanceTo(c); 11 double z=c.distanceTo(a); 12 13 double len=(x+y+z)/2; 14 15 double size=sqrt(len*(len-x)*(len-y)*(len-z)); 16 17 return size; 18 } 19 int main() 20 { 21 22 Point p1; 23 Point p2(-2,0); 24 Point p3(0,2); 25 26 cout<<computeArea(p1,p2,p3)<<endl; 27 28 return 0; 29 30 }