I want to classify a triangle on the sides, and a triangle with all equal sides is called Equilateral, with all sides different from each other called Scalene, and if it has only two equal sides, it is called Isosceles. p>
I tried to do this:
void HeaderClass::ClassificarUmTriangulo() {
int x1, x2, x3, y1, y2, y3, a, b, c;
cout << "Coordenadas do ponto1 (x): ";
cin >> x1;
cout << "Coordenadas do ponto1 (y): ";
cin >> y1;
cout << "Coordenadas do ponto2 (x): ";
cin >> x2;
cout << "Coordenadas do ponto2 (y): ";
cin >> y2;
cout << "Coordenadas do ponto3 (x): ";
cin >> x3;
cout << "Coordenadas do ponto3 (y): ";
cin >> y3;
Sleep(SLEEP_1);
a = sqrt(((x2 - x1)*(x2 - x1)) + ((y2 - y1)*(y2 - y1)));
b = sqrt(((x3 - x2)*(x3 - x2)) + ((y3 - y2)*(y3 - y2)));
c = sqrt(((x1 - x3)*(x1 - x3)) + ((y1 - y3)*(y1 - y3)));
if (a == b && b == c) {
system("cls");
cout << "Triangulo equilatero." << endl;
}
At least using the condition if
to get an equilateral triangle, but I have not yet been able to get the rest, what will be the way, using conditions if
, else if
and else