0

hello

I have done this program that prompts the user to input the length of the sides of a triangle and outputs the shape of the triangle. Using an enumeration type, triangleType, that has the values scalene, isosceles, equilateral, and notTriangle. so the problem i ma having with the program is that when it is supposed to find which type of triangle it is it messes up the answer.

instead of outputting:

the shape with the sides of 9, 9, 9 is an equilateral triangle.

it outputs this:

the shape with the sides of 9, 9, 9 is an isosceles triangle instead

would really appreciate the help.

```
#include <iostream>
using namespace std;
enum triangleType{scalene, isosceles, equilateral, notTriangle};
triangleType shape;
void inputTriangle(int& L1, int& L2, int& L3);
void outputShape(int L1, int L2, int L3, triangleType shape);
triangleType triangleShape(int L1, int L2, int L3, triangleType& shape);
int main()
{
int L1, L2, L3;
inputTriangle(L1, L2, L3);
triangleShape(L1, L2, L3, shape);
outputShape(L1, L2, L3, shape);
return 0;
}
void inputTriangle(int& L1, int& L2, int& L3)
{
cout<<"Enter the lengths of each side of the triangle (seperate with spaces)."<<endl;
cin>>L1>>L2>>L3;
}// end of inputTriangle.
void outputShape(int L1, int L2, int L3, triangleType shape)
{
switch(shape)
{
case scalene:
cout<<"The shape with the sides of "<<L1<<", "<<L2<<", "<<L3<<" is a scalene triangle."<<endl;
break;
case isosceles:
cout<<"The shape with the sides of "<<L1<<", "<<L2<<", "<<L3<<" is an isosceles triangle."<<endl;
break;
case equilateral:
cout<<"The shape with the sides of "<<L1<<", "<<L2<<", "<<L3<<" is an eqilateral traiangle."<<endl;
break;
case notTriangle:
cout<<"The shape with the sides of "<<L1<<", "<<L2<<", "<<L3<<" is not a triangle."<<endl;
} // end of switch
} //end of outputShape.
triangleType triangleShape(int L1, int L2, int L3, triangleType& shape)
{
if (L1 + L2 > L3)
if (L1 != L2 && L2 != L3)
shape = scalene;
else if (L1 == L2 || L2 == L3 || L1 == L3)
shape = isosceles;
else if (L1 == L2 && L2 == L3)
shape = equilateral;
else
shape = notTriangle;
return shape;
} //end of outputShape
```