I'm having troubles with a code for a program (involving classes) where I am supposed to input the three sides of a triangle and the program determines whether the triangle is a right triangle, equilateral, isosceles, and scalene, etc.

I have only one error preventing me from compiling my program, and it is a c2062 "Type 'int' unexpected" error. It is related to a constructor I've written. If somebody can at least point out to me what's wrong and how to fix it, I would appreciate it.

At any rate, here's the header file:

```
#include<string>
using namespace std;
class Triangle
{
private:
int side1;
int side2;
int side3;
int largest();
int smallest();
public:
Triangle() ; //Default Constructor
Triangle(int side1, int side2, int side3);
bool isRight();
bool isEquilateral();
bool isIsosceles();
bool isScalene();
void print();
};
```

And the Triangle.cpp file (different from the main function).

```
#include <iostream>
#include <string>
#include <iomanip>
#include "Triangle.h"
#include <cmath>
Triangle::Triangle()
{
side1=0;
side2=0;
side3=0;
}
Triangle(int side1,int side2,int side3);
int Triangle::largest()
{
// For the largest side of the triangle:
int largest=side1;
if (side2 > largest)
{
largest=side2;
}
if (side3 > largest)
{
largest=side3;
}
;
}
int Triangle::smallest()
{
int smallest=side1;
if (side2 < smallest)
{
smallest=side2;
}
if (side3 < smallest)
{
smallest=side3;
}
}
bool Triangle::isEquilateral()
{
if (largest() == smallest())
{
return true;
}
else
{
return false;
}
}
bool Triangle::isIsosceles()
// If the triangle is isosceles or not.
{
if (side1 == side2)
{
return true;
}
else if (side1 == side3)
{
return true;
}
else if (side2 == side3)
{
return true;
}
else if (side1 != side2 && side1 != side3 && side2 != side3)
{
return false;
}
}
bool Triangle::isScalene()
{
if (isIsosceles()== true)
{
return false;
}
else
{
return true;
}
}
bool Triangle::isRight()
{
if ( pow((double) side1,2) == (pow((double) side2,2) + pow((double) side3,2)))
{
return true;
}
else if (pow((double) side2,2) == (pow((double) side1,2) + pow((double) side3,2)))
{
return true;
}
else if (pow((double) side3,2) == (pow((double) side1,2) + pow((double) side2,2)))
{
return true;
}
else
{
return false;
}
}
void Triangle::print()
{
cout << side1 << " " << side2 << " " << side3 << " " << "triangle:" << endl;
}
```

The error is specifically related to "Triangle(int side1,int side2,int side3);" Also, it does that no matter the variables within the three arguments after "Triangle"- it's just whenever I place "int" in there.

Thanks!

*Edited 6 Years Ago by sah15*: n/a