Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 715769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:13:27+00:00 2026-05-14T05:13:27+00:00

I do not understand how to use enumeration types. I understand what they are,

  • 0

I do not understand how to use enumeration types. I understand what they are, but I don’t quite get their purpose.

I have made a program that inputs three sides of a triangle and outputs whether or not they are isosceles, scalene, or equilateral. I’m suppose to incorporate the enumeration type somewhere, but don’t get where and how to use them. Any help would be appreciated.

#include <iostream>

using namespace std;

enum triangleType {scalene, isosceles, equilateral, noTriangle};

triangleType triangleShape(double x, double y, double z);
void printTriangleShape(triangleType shape);

int main()
{
    double x, y, z;
    triangleType scalene, isosceles, equilateral, noTriangle;

    cout << "Please enter the three sides of a triangle:" << endl;
    cout << "Enter side 1: ";
    cin >> x;
    cout << endl;
    cout << "Enter side 2: ";
    cin >> y;
    cout << endl;
    cout << "Enter side 3: ";
    cin >> z;
    cout << endl;

    triangleType t = triangleShape(x, y, z); 
printTriangleShape(t);

    return 0;
}

triangleType triangleShape(double x, double y, double z)
{
   triangleType scalene, isoceles, equilateral, noTriangle;
    if (((x+y) > z) && ((x+z) > y) && ((y+z) > x))
    {
        cout << "You have a triangle!" << endl;
            if (x == y && y == z)
               return equilateral;
            else if (x == y || x == z || y == z)
                 return isosceles;
            else
               return scalene;
    }
    else if ((x+y) <= z || ((x+z) <= y) || ((y+z) <= x))
        return noTriangle;  
} 
void printTriangleShape(triangleType shape)
{
    switch (shape)
    {
    case scalene: cout << "Your triangle is Scalene!" << endl;
        break;
    case isosceles: cout << "Your triangle is an isosceles!" << endl;
        break;
    case equilateral: cout << "Your triangle is an equilateral!" << endl;
        break;

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:13:28+00:00Added an answer on May 14, 2026 at 5:13 am

    It’s a value, and you probably want to return it from your function.

    Try:

    triangleType triangleShape(double x, double y, double z) {
      if (...) {
        return scalene;
      } else if (...) {
        return isosceles.
      } else if (...) {
        return equilateral
      } else {
        return noTriangle;
      } 
    }
    

    Note, you can print the result, but it will print as an integer:
    scalene = 0, isosceles = 1, ...

    Edit, for printing you may want to do this:

    void printTriangleShape(triangleType shape) {
       switch (shape) {
         case scalene:
           cout << "Your triangle is Scalene!" << endl;
           break;
         case isosceles:
           cout << "Your triangle is isosceles!" << endl;
           break;
         ...;
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Try to use, but do not understand what should i do for enabling of
I've seen several examples that use android:layout_height=0px or 0dip but i do not understand
I am new to java and learning interfaces. I did not understand the use
I am trying to better understand when I should and should not use Iterators.
I don't understand how to use this feature called Build deployment package in VS
I could not understand the ipython library. This url provide the common feature but
I was studying the radix sort algorithm but I could not understand some of
I can not understand how to use the same function in several java classes.
I'm taking a Java assessment test. I do not understand the use of the
i do not understand the use of an internal implementation of jax-ws packages inside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.