Well basically I need to find a way to fix this problem I keep on having.
Here is my code.
Code:
Triangle calculateTriangleType(int &sOne,int &sTwo,int &sThree)
{
Triangle result;
if(sOne + sTwo < sThree || sOne + sThree < sTwo || sTwo + sThree < sOne)
result = NO_TRIANGLE;
if(sOne == sTwo && sOne == sThree)
result = EQUILATERAL;
if(sOne == sTwo && sOne != sThree || sTwo == sThree && sTwo != sOne || sThree == sOne && sThree != sTwo)
result = ISOCELES;
if(sOne != sTwo && sOne != sThree)
result = SCALENE;
return result;
}
Here is my problem. At the way this is currently setup I have no issues with most things. However my problem arises when it should be identifying a No_Triangle as a Scalene. Also keep in mind for any triangle to be considered a triangle any two of its sides must be greater than the third.
Here is an example of my various outputs and what problem I keep having.
Code:
Please enter a value for side 1 of your triangle: 1
Please enter a value for side 2 of your triangle: 1
Please enter a value for side 3 of your triangle: 1
The lengths of the sides that you entered were: 1, 1, and 1.
Equilateral!
Would you like to continue (Y or N)? y
Please enter a value for side 1 of your triangle: 12
Please enter a value for side 2 of your triangle: 12
Please enter a value for side 3 of your triangle: 11
The lengths of the sides that you entered were: 12, 12, and 11.
isoceles!
Would you like to continue (Y or N)? y
Please enter a value for side 1 of your triangle: 1
Please enter a value for side 2 of your triangle: 2
Please enter a value for side 3 of your triangle: 3
The lengths of the sides that you entered were: 1, 2, and 3.
Scalene!
Would you like to continue (Y or N)? y
Please enter a value for side 1 of your triangle: 900
Please enter a value for side 2 of your triangle: 1
Please enter a value for side 3 of your triangle: 3
The lengths of the sides that you entered were: 900, 1, and 3.
Scalene!
Would you like to continue (Y or N)? y
Please enter a value for side 1 of your triangle: 3
Please enter a value for side 2 of your triangle: 1
Please enter a value for side 3 of your triangle: 1
The lengths of the sides that you entered were: 3, 1, and 1.
Scalene!
Note that the bolded ones should not be Scalene, but in fact should be No_Triangle.
Not sure on the logic needed to make this happen.
Any help would be greatly appreciated.