With monday.comâ€™s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.
#include <cmath>
typedef enum {
TriangleType_scalene = 1,
TriangleType_isosceles = 2,
TriangleType_equilateral = 3,
TriangleType_error = 4
} TriangleType;
inline int cmpDouble(double &d1, double &d2) {
if (fabs(d1 - d2) < 0.00001) return 0;
if (d1 < d2) return -1;
else return 1;
}
TriangleType checkTriangle(double a, double b, double c) {
if ((a <= 0.0) || (b <= 0.0) || (c <= 0.0)) {
return TriangleType_error;
}
if (!cmpDouble(a, b) && !cmpDouble(b, c)) {
return TriangleType_equilateral;
}
if (!cmpDouble(a, b) || !cmpDouble(b, c) || !cmpDouble(a, c)) {
return TriangleType_isosceles;
}
return TriangleType_scalene;
}
--trigger-happy
Open in new window