what's wrong??

my program complains about the lack of a ';' i can't find.
The problem is between line 15 and 19.
HEEELP!!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <iostream>
#include <conio.h>
#include <math.h>

using namespace std;

class TrianguloEquilatero {
      float x1, x2, x3, y1, y2, y3;
      float lado1, lado2, lado3;
      public:
             void getCoordenadas();
             TrianguloEquilatero() {getCoordenadas();}
             void perimetro();
             void area();
             void ehEquilatero() {
                  (lado1 == lado2 && lado1 == lado3) ? (cout << "\nO triangulo e equilatero" : cout << "\nO triangulo nao e equilatero");
             }
};

void TrianguloEquilatero::getCoordenadas() {
     cout << "A:\nx1: ";
     cin >> x1;
     cout << "y1: ";
     cin >> y1;
     cout << "\nB:\nx2: ";
     cin >> x2;
     cout << "y2: ";
     cin >> y2;
     cout << "\nC:\nx3: ";
     cin >> x3;
     cout << "y3: ";
     cin >> y3;
     
     if (x1 < -0.005 && x1 > -19.995 && x2 < -0.005 && x2 > -19.995 && x3 < -0.005 && x3 > -19.995
      && y1 < -0.005 && y1 > -19.995 && y2 < -0.005 && y2 > -19.995 && y3 < -0.005 && y3 > -19.995)
        cout << "\nTodos os pontos estao no terceiro quadrante\n" << endl;
        else
            cout << "\nNem todos os pontos estao no terceiro quadrante\n" << endl;
}

void TrianguloEquilatero::perimetro() {
     lado1 = sqrt(pow(x1-x2, 2) + pow(y1-y2, 2));
     lado2 = sqrt(pow(x2-x3, 2) + pow(y2-y3, 2));
     lado3 = sqrt(pow(x3-x1, 2) + pow(y3-y1, 2));
      
      cout << "AB: " << lado1
         << "\nBC: " << lado2
         << "\nCA: " << lado3
      << "\nPerimetro do Triangulo: " << lado1 + lado2 + lado3 << endl;
}

void TrianguloEquilatero::area() {
     float altura = sqrt(pow(lado1, 2) - (pow(lado3, 2))/4);
     cout << "\nAltura: " << altura << "\nBase: " << lado3
     << "\nArea: " << (altura*lado3)/2 << endl;
}

int main () {
    TrianguloEquilatero T;
    
    T.perimetro();
    T.area();
    T.ehEquilatero();
    
    getch();
    return 0;
}
Last edited on
cout << "\nO triangulo e equilatero"

No semicolon needed here.
Last edited on
still not working
What is the error now?
it was lacking an ')' before :
no more problems
Topic archived. No new replies allowed.