Hey... I've been working on this program using the enumeration type. When I execute what I've written, it returns a number instead of the type of triangle it is. If you could look at the code and help me out I'd appreciate it!
Code:#include <iostream>
using namespace std;
enum triangleType {scalene, isosceles, equilateral, noTriangle};
triangleType triangleShape(double, double, double);
int main()
{
double firstSide, secondSide, thirdSide;
cout << "Enter the lengths of the three sides of a triangle." << endl;
cin >> firstSide >> secondSide >> thirdSide;
cout << endl;
cout << "The shape of the triangle is: "
<< triangleShape(firstSide, secondSide, thirdSide) << endl;
return 0;
}
triangleType triangleShape(double firstSide, double secondSide, double thirdSide)
{
triangleType type;
if (firstSide + secondSide <= thirdSide || firstSide + thirdSide <= secondSide ||
secondSide + thirdSide <= firstSide)
{
type = noTriangle;
}
if (firstSide + secondSide > thirdSide && firstSide + thirdSide > secondSide &&
secondSide + thirdSide > firstSide)
{
if (firstSide != secondSide && firstSide != thirdSide && secondSide != thirdSide)
{
type = scalene;
}
else if (firstSide == secondSide || firstSide == thirdSide || secondSide == thirdSide)
{
type = isosceles;
}
else
{
type = equilateral;
}
}
return type;
}