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 3870626
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T21:44:45+00:00 2026-05-19T21:44:45+00:00

I am writing a program that is supposed to help me learn about enumeration

  • 0

I am writing a program that is supposed to help me learn about enumeration data types in C++. The current trouble is that the compiler doesn’t like my enum usage when trying to use the new data type as I would other data types. I am getting the error “redeclared as different kind of symbol” when compiling my trangleShape function. Take a look at the relevant code. Any insight is appreciated! Thanks!

(All functions are their own .cpp files.)

header file

#ifndef HEADER_H_INCLUDED
#define HEADER_H_INCLUDED

#include <iostream>
#include <iomanip>

using namespace std;

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

//prototypes
void extern input(float&, float&, float&);
triangleType extern triangleShape(float, float, float);
/*void extern output (float, float, float);*/
void extern myLabel(const char *, const char *);



#endif // HEADER_H_INCLUDED

main function

//8.1 main
// this progam...

#include "header.h"

int main()
{
    float sideLength1, sideLength2, sideLength3;
    char response;


     do //main loop
      {
           input (sideLength1, sideLength2, sideLength3);
           triangleShape (sideLength1, sideLength2, sideLength3);
           //output (sideLength1, sideLength2, sideLength3);
           cout << "\nAny more triangles to analyze? (y,n) ";
           cin >> response;
      }
    while (response == 'Y' || response == 'y');

    myLabel ("8.1", "2/11/2011");

    return 0;
}

triangleShape shape

# include "header.h"

triangleType triangleShape(sideLenght1, sideLength2, sideLength3)
{
    triangleType triangle;
    return triangle;
}
  • 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-19T21:44:46+00:00Added an answer on May 19, 2026 at 9:44 pm

    Your problem has nothing to do with enums. The problem line is this line in your triangleShape definition:

    triangleType triangleShape(sideLenght1, sideLength2, sideLength3)
    

    You’re missing the types for your parameters and some compilers such as gcc default to int (although this isn’t standard behaviour so you should never rely on it). Since the function definition uses floats the compiler sees it as redeclaring it differently. You should use specify floats in the implementation:

    triangleType triangleShape(float sideLenght1, float sideLength2, float sideLength3)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a program for a school project that is supposed to emulate the
I am writing a program that creates ICC color formats. These formats specify a
I am writing a program that needs to take text input, and modify individual
I'm writing a program (a theorem prover as it happens) whose memory requirement is
Background: I'm writing an installation for a SharePoint component. In addition to getting the
Before anything, let me first clarify that the below thoughts are purely my personal
I am using Django and am making some long running processes that I am
I'm interested in finding out what's the shortest script one can write to replace
I am trying to write a generic extension to turn a ManagementObjectCollection into a
I was wondering if it's possible to run two projects at the same time

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.