Documente Academic
Documente Profesional
Documente Cultură
#include <cmath>
class Punct {
private:
float x, y;
public:
Punct(float xCoord, float yCoord) : x(xCoord), y(yCoord) {}
void afisare() {
std::cout << "(" << x << ", " << y << ")";
}
class Triunghi {
private:
Punct varf1, varf2, varf3;
public:
Triunghi(Punct p1, Punct p2, Punct p3) : varf1(p1), varf2(p2), varf3(p3) {}
void verificaTip() {
float latura1 = distanta(varf1, varf2);
float latura2 = distanta(varf2, varf3);
float latura3 = distanta(varf3, varf1);
private:
float distanta(Punct p1, Punct p2) {
return std::sqrt(std::pow(p2.x - p1.x, 2) + std::pow(p2.y - p1.y, 2));
}
};
int main() {
Punct p1(0, 0);
Punct p2(1, 0);
Punct p3(0.5, std::sqrt(3) / 2);
return 0;
}