class point { int x; int y; public: point(): x(0), y(0) {} void setkoord(int koordx,int koordy) { x = koordx; y = koordy; } int getx()const { return x; } int gety()const { return y; } };
double length(point p1, point p2) { return (sqrt(pow(double(p1.getx()-p2.getx()),2)+pow(double(p1.gety()-p2.gety()),2))); }
#include <cmath>
class point
{
int x;
int y;
public:
point(): x(0), y(0) {}
void setkoord(int koordx,int koordy)
{
x = koordx;
y = koordy;
}
int getx()const { return x; }
int gety()const { return y; }
};
double length(point p1, point p2)
{
return (sqrt(pow(double(p1.getx()-p2.getx()),2)+pow(double(p1.gety()-p2.gety()),2)));
}
int main()
{
point A,B,C;
B.setkoord(1,1);
C.setkoord(1,0);
double a=length(A,B), b=length(B,C), c=length(C,A);
double p=(a+b+c)/2;
double s=sqrt(p*(p-a)*(p-b)*(p-c));
std::cout <<"square: " <<s <<std::endl;
return 0;
}