#include <iostream>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
using namespace std;
double distance(double x1, double y1, double x2, double y2)
{
return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
int main() {
double ax, ay, bx, by, cx, cy;
double ab, ac, bc;
cout << "A: ";
cin >> ax >> ay;
cout << "B: ";
cin >> bx >> by;
cout << "C: ";
cin >> cx >> cy;
ab = distance(ax, ay, bx, by);
bc = distance(bx, by, cx, cy);
ac = distance(ax, ay, cx, cy);
// Используем свойство тупоугольности треугольника: a^2+b^2<c^2
if ((ab * ab + bc * bc < ac * ac) || (ab * ab + ac * ac < bc * bc) || (bc * bc + ac * ac < ab * ab))
// Площадь по формуле Герона
double hp = (ab + ac + bc) / 2; // Полупериметр
cout << "Square: " << sqrt(hp * (hp - ab) * (hp - ac) * (hp - bc)) << endl;
cout << max(max(ab, ac), bc) << ", "
<< (ab + ac + bc - min(min(ab, ac), bc) - max(max(ab, ac), bc)) << ", "
<< min(min(ab, ac), bc);
else cout << "Entered points cannot be vertices of an obtuse triangle";
return 0;
#include <iostream>
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
using namespace std;
double distance(double x1, double y1, double x2, double y2)
{
return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
int main() {
double ax, ay, bx, by, cx, cy;
double ab, ac, bc;
cout << "A: ";
cin >> ax >> ay;
cout << "B: ";
cin >> bx >> by;
cout << "C: ";
cin >> cx >> cy;
ab = distance(ax, ay, bx, by);
bc = distance(bx, by, cx, cy);
ac = distance(ax, ay, cx, cy);
// Используем свойство тупоугольности треугольника: a^2+b^2<c^2
if ((ab * ab + bc * bc < ac * ac) || (ab * ab + ac * ac < bc * bc) || (bc * bc + ac * ac < ab * ab))
{
// Площадь по формуле Герона
double hp = (ab + ac + bc) / 2; // Полупериметр
cout << "Square: " << sqrt(hp * (hp - ab) * (hp - ac) * (hp - bc)) << endl;
cout << max(max(ab, ac), bc) << ", "
<< (ab + ac + bc - min(min(ab, ac), bc) - max(max(ab, ac), bc)) << ", "
<< min(min(ab, ac), bc);
}
else cout << "Entered points cannot be vertices of an obtuse triangle";
return 0;
}