lundi 28 septembre 2015

Display Type of Triangle Based on Angles

            else if ((ang1 != ang2) && (ang2 != ang3) && (ang1 != ang3))
                {
                    if ((ang1 = 90) || (ang2 = 90) || (ang3 = 90))
                    {
                        cout << "This is a Right, Scalene Triangle!";
                    }
                    else if ((ang1 < 90) && (ang2 < 90) && (ang3 < 90))
                    {
                        cout << "This is an Acute, Scalene Triangle!";
                    }
                    else if ((ang1 > 90) || (ang2 > 90) || (ang3 > 90))
                    {
                        cout << "This is an Obtuse, Scalene Triangle!";
                    }
                    else
                    {
                        // you shouldn't get here
                    }
                }

No matter what I put in for ang1, ang2, or ang3; it'll say it is a right, scalene triangle. I don't understand why it is ignoring the second else-if statements parameters.

Aucun commentaire:

Enregistrer un commentaire