If

Can you tell me what's wrong?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
   int main()
{

float a,b,c;
    cin>>a>>b>>c;
    if (a+b>0 && b+c>0 && a+c>0)
        {

      if((a=b) && (b=c)){
            cout<<"Equilateral triangle"<<endl;
            }
      else if ((a=b) || (b=c)||(a=c))
        {
        cout<<"Isoscelesis triangle"<<endl;
      }
      else{
        cout<<"Scalene"<<endl;
  } } else{
        cout<<"You cant make a triangle"<<endl;
      }

 return 0;
}
closed account (E0p9LyTq)
It should be, for example, (a == b), not (a = b).

You are assigning values, which will always be treated as true in your if statements. You want to check if the variables are equal.

The = / == error is one of the most common errors new programmers make, and one of the hardest to find.
damn, i knew that, THANKS!
Topic archived. No new replies allowed.